Solved runTaskAsynchronously

Discussion in 'BungeeCord Plugin Development' started by DianoxDragon, Jun 11, 2019.

  1. Hello,

    I would like to convert a bukkit code (that matches my needs) is transposed under bungeecord code, I have already searched but I can't find exactly what I'm looking for.

    Bukkit code :
    Code (Java):
    BukkitRunnable runmysql = new BukkitRunnable() {
                    @Override
                    public void run() {
                        try {
                            openConnection();
                            statement = connection.createStatement();
                        } catch (ClassNotFoundException e) {
                            e.printStackTrace();
                        } catch (SQLException e) {
                            e.printStackTrace();
                        }
                    }
                };
               
                runmysql.runTaskAsynchronously(this);
    it's the code for mysql in public void onEnable()

    I would like to create a new code like that in bungeecord, but I can't find it
    thanks again
     
  2. You can use ComplateableFuture.
    https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html

    In addition I recommend a connection pool and a thread pool. Also depends on how you want to use your DB.
     
  3. Okay thank you for your answer
     

Share This Page