Mongo issues with Bungee

Discussion in 'BungeeCord Plugin Development' started by WeeSkilz, May 16, 2015.

  1. I am getting this error on enabling my bungee plugin.

    The error's root is in my use of mongo as the error is caused when I create a new MongoClient.

    I was wondering if mongo plays nicely with Bungee and if so, what's the solution?
     
  2. You should put this post under the "Bungeecord Plugin Develpment" section.
     
  3. I reported it to get it moved, but thanks.
     
  4. BungeeCord has an annoying security manager, you'll have to use the scheduler instead of creating your own threads.
     
  5. Mongo's driver launches a separate thread for its communications with the database. Any ways to get around that?
     
  6. Use bungee scheduler to initialize Mongo's connection or pool.

    Code (Text):
    FutureTask<?> task = new FutureTask<>(new Runnable()
    {
       @Override
       public void run()
       {
         // Init here
       }
    }, null);
    getProxy().getScheduler().runAsync(this, task);
    try
    {
       task.get();
    }
    catch(ExecutionException | InterruptedException ex)
    {
       // Initialize exception
    }