Class UpdateClasses

java.lang.Object
org.voltdb.client.UpdateClasses

public class UpdateClasses extends Object
Utility class, providing methods to load updated classes into a VoltDB database.

Each such method is a convenience method that is equivalent to reading a jarfile, containing classes to be added/updated, into a byte array, then using the client API to execute a call to the @UpdateClasses system procedure. Classes can be removed from the database by giving their names in a separate argument.

  • Constructor Details

    • UpdateClasses

      public UpdateClasses()
  • Method Details

    • update

      public static ClientResponse update(Client client, File jarPath, String classesToDelete) throws IOException, ProcCallException
      Synchronously updates class definitions. Blocks until a result is available. A ProcCallException is thrown if the response is anything other than success.
      Parameters:
      client - A connected Client.
      jarPath - Path to the jar file containing new/updated classes.
      classesToDelete - comma-separated list of classes to delete.
      Returns:
      ClientResponse instance of procedure call result.
      Throws:
      IOException - If the file cannot be serialized or if there is a Java network error.
      ProcCallException - on any VoltDB-specific failure.
    • update

      public static boolean update(Client client, ProcedureCallback callback, File jarPath, String classesToDelete) throws IOException
      Asynchronously updates class definitions. Does not guarantee that the invocation was actually queued: check the return value to determine if queuing actually took place.
      Parameters:
      client - A connected Client.
      callback - The ProcedureCallback that will be invoked with the result.
      jarPath - Path to the jar file containing new/updated classes.
      classesToDelete - comma-separated list of classes to delete.
      Returns:
      true if the procedure was queued and false otherwise.
      Throws:
      IOException - If the file cannot be serialized or if there is a Java network error.
    • updateSync

      public static ClientResponse updateSync(Client2 client, File jarPath, String classesToDelete) throws IOException, ProcCallException
      Synchronously updates class definitions via a "version 2" client. Blocks until a result is available. A ProcCallException is thrown if the response is anything other than success.
      Parameters:
      client - A connected Client2.
      jarPath - Path to the jar file containing new/updated classes.
      classesToDelete - comma-separated list of classes to delete.
      Returns:
      ClientResponse instance of procedure call result.
      Throws:
      IOException - If the file cannot be serialized or if there is a Java network error.
      ProcCallException - on any VoltDB-specific failure.
    • updateAsync

      public static CompletableFuture<ClientResponse> updateAsync(Client2 client, File jarPath, String classesToDelete) throws IOException
      Asynchronously updates class definitions via a "version 2" client. Completion is communicated via a returned CompletableFuture.
      Parameters:
      client - A connected Client2.
      jarPath - Path to the jar file containing new/updated classes.
      classesToDelete - comma-separated list of classes to delete.
      Returns:
      a CompletableFuture that completes when the procedure call completes.
      Throws:
      IOException - If the file cannot be serialized.