Class SwitchAdminHandler

java.lang.Object
org.jgroups.admin.AdminHandler
org.jgroups.admin.SwitchAdminHandler

public class SwitchAdminHandler extends AdminHandler
Manages the switch from one protocol configuration to another one (same JGroups version). Details in https://redhat.atlassian.net/browse/JGRP-3043
Since:
5.6.0
Author:
Bela Ban
  • Field Details

  • Constructor Details

    • SwitchAdminHandler

      public SwitchAdminHandler(JChannel ch)
  • Method Details

    • listener

      public SwitchAdminHandler listener(SwitchListener l)
    • timeout

      public SwitchAdminHandler timeout(long t)
    • executeRequest

      public String executeRequest(String req)
      Overrides:
      executeRequest in class AdminHandler
    • switchToNewConfiguration

      public boolean switchToNewConfiguration(String file)
      Triggers a switch to a new configuration. Returns true when the switch was successful, else false. False means that all cluster members are still running the current configuration.
    • handleRequest

      public void handleRequest(Message msg, AdminHeader hdr)
      Specified by:
      handleRequest in class AdminHandler
    • handleResponse

      public void handleResponse(Message msg, AdminHeader hdr)
      Specified by:
      handleResponse in class AdminHandler
    • handleCreateNewStack

      public boolean handleCreateNewStack(String s, Address sender)
      Gets the version and config. Creates a new protocol stack with the old channel's address injected into it. Adds VERSION (with the received version) above the transport. Then the up_handler and receiver of the old channel are nulled (and saved for later).
      On a rollback, the new stack is destroyed and the up_handler and receiver of the old channel are re-inserted.
      On a commit, the new protocol stack is set in the existing channel and up_handler and receiver are re-inserted. The old stack is then destroyed.
    • handleConnect

      public boolean handleConnect(String s, Address sender)
      Connects the channel and waits for expected_members. Returns true if cluster size == expected_members, false oherwise
      Parameters:
      sender -
    • notifyListener

      protected void notifyListener(double percentage, String msg)
    • print

      protected static String print(ResponseCollector<String> r)
    • createNewStack

      protected static String createNewStack(String new_config, int version)
    • createNewChannel

      protected static JChannel createNewChannel(int version, String config, String name) throws Exception
      Throws:
      Exception
    • rollbackCompletedPhases

      protected void rollbackCompletedPhases()
      Rolls back already completed phases if a later phase fails (latest completed first)
    • readFile

      protected static String readFile(String filename)