public GroupManagementService getGMS(String groupName) { //return the gms instance for that group try { return GMSFactory.getGMSModule(groupName); } catch (GMSException e) { GMS_LOGGER.log(LogLevel.SEVERE, GMS_EXCEPTION_CANNOT_GET_GROUP_MODULE, new Object [] {groupName , e.getLocalizedMessage()}); return null; } }
@Override public void complete() { initialized.compareAndSet(true, false); initializationComplete.compareAndSet(true, false); gms = null; GMSFactory.removeGMSModule(clusterName); }
public static GroupManagementService getGroupManagementServiceInstance() { GroupManagementService gmsImpl = null; try { gmsImpl = findByServiceLoader(); } catch (Throwable t) { // jdk 5 will end up here. Not a reportable error. } if (gmsImpl == null) { String classname = "com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl"; gmsImpl = findByClassLoader(classname); } return gmsImpl; }
try { //sanity check: if this group instance is gms = getGMSModule(groupName); } catch (GMSException e) { gms = getGroupManagementServiceInstance(); gms.initialize(serverToken, groupName, memberType, properties) ; memberToken = serverToken; groups.put(getCompositeKey(groupName), gms );
private void init(String myName, String groupName, boolean startGMS) { try { gms = GMSFactory.getGMSModule(groupName); } catch (Exception e) { logger.severe("GMS module for group " + groupName + " not enabled"); gms = (GroupManagementService) GMSFactory.startGMSModule( myName, groupName, memberType, configProps);
/** * This returns an instance of the GroupManagementService for a given * non-null group name. * @param groupName groupName * @return GroupManagementService * @throws GMSException - if the groupName is null * * @throws GMSNotEnabledException - If GMS is not enabled * @throws GMSNotInitializedException - If GMS is not initialized */ public static GroupManagementService getGMSModule(final String groupName) throws GMSNotEnabledException, GMSException, GMSNotInitializedException { if(groupName == null){ throw new GMSException(sm.get("ex.factory.start.missing.group")); } final String key = getCompositeKey(groupName); if(groups.containsKey(key)) return groups.get(key); else if(!isGMSEnabled(groupName)){ throw new GMSNotEnabledException(sm.get("ex.factory.get.gms.is.disabled", new Object[]{groupName})); } else { throw new GMSNotInitializedException(sm.get("ex.factory.get.not.init", new Object[]{groupName})); } } /**
gms = (GroupManagementService) GMSFactory.startGMSModule(instanceName, clusterName, GroupManagementService.MemberType.valueOf(memberType), configProps); GMSFactory.setGMSEnabledState(clusterName, Boolean.TRUE); if (gms != null) { try {
/** * removes the GMS instance that is cached from a prior initialization. This * is typically called only when GMS module is being shutdown by a lifecycle * action. * @param groupName Name of the Group */ public static void removeGMSModule(final String groupName){ if(groupName != null){ final String key = getCompositeKey(groupName); if(groups.containsKey(key)){ groups.remove(key); } } }
/** * This is to be used only in the case where this process is a member of * one and only one group and the group name is unknown to the caller. * @return GroupManagementService * @throws GMSException - wraps a throwable GMSNotInitializedException if * there are no GMS instances found. */ public static GroupManagementService getGMSModule() throws GMSException { GroupManagementService gms; final Collection instances = getAllGMSInstancesForMember(); if(instances.size() == 0){ throw new GMSNotInitializedException(sm.get("ex.init.failure")); } gms = (GroupManagementService)instances.toArray()[0]; return gms; }
try { //sanity check: if this group instance is gms = getGMSModule(groupName); } catch (GMSException e) { gms = getGroupManagementServiceInstance(); gms.initialize(serverToken, groupName, memberType, properties) ; memberToken = serverToken; groups.put(getCompositeKey(groupName), gms );
/** * This returns an instance of the GroupManagementService for a given * non-null group name. * @param groupName groupName * @return GroupManagementService * @throws GMSException - if the groupName is null * * @throws GMSNotEnabledException - If GMS is not enabled * @throws GMSNotInitializedException - If GMS is not initialized */ public static GroupManagementService getGMSModule(final String groupName) throws GMSNotEnabledException, GMSException, GMSNotInitializedException { if(groupName == null){ throw new GMSException(sm.get("ex.factory.start.missing.group")); } final String key = getCompositeKey(groupName); if(groups.containsKey(key)) return groups.get(key); else if(!isGMSEnabled(groupName)){ throw new GMSNotEnabledException(sm.get("ex.factory.get.gms.is.disabled", new Object[]{groupName})); } else { throw new GMSNotInitializedException(sm.get("ex.factory.get.not.init", new Object[]{groupName})); } } /**
/** * removes the GMS instance that is cached from a prior initialization. This * is typically called only when GMS module is being shutdown by a lifecycle * action. * @param groupName Name of the Group */ public static void removeGMSModule(final String groupName){ if(groupName != null){ final String key = getCompositeKey(groupName); if(groups.containsKey(key)){ groups.remove(key); } } }
/** * This is to be used only in the case where this process is a member of * one and only one group and the group name is unknown to the caller. * @return GroupManagementService * @throws GMSException - wraps a throwable GMSNotInitializedException if * there are no GMS instances found. */ public static GroupManagementService getGMSModule() throws GMSException { GroupManagementService gms; final Collection instances = getAllGMSInstancesForMember(); if(instances.size() == 0){ throw new GMSNotInitializedException(sm.get("ex.init.failure")); } gms = (GroupManagementService)instances.toArray()[0]; return gms; }
gms = GMSFactory.getGMSModule(clusterName); } catch (GMSException ge) {
public static GroupManagementService getGroupManagementServiceInstance() { GroupManagementService gmsImpl = null; try { gmsImpl = findByServiceLoader(); } catch (Throwable t) { // jdk 5 will end up here. Not a reportable error. } if (gmsImpl == null) { String classname = "com.sun.enterprise.ee.cms.impl.common.GroupManagementServiceImpl"; gmsImpl = findByClassLoader(classname); } return gmsImpl; }
/** * Called when the application layer is shutting down and this member needs to leave * the group formally for a graceful shutdown event. * * @param shutdownType shutdown type corresponds to the shutdown types specified * in GMSConstants.shudownType enum. */ private void leave(final GMSConstants.shutdownType shutdownType) { // ensure that only leave the group once. if (hasLeftGroup.compareAndSet(false, true)) { try { logger.log(Level.INFO, "gms.leave", new Object[]{memberName, ctx.getGroupName()}); ctx.leave(shutdownType); removeAllActionFactories(); } finally { hasJoinedGroup.set(false); GMSFactory.removeGMSModule(ctx.getGroupName()); GMSContextFactory.removeGMSContext(ctx.getGroupName()); } } }
/** * Called when the application layer is shutting down and this member needs to leave * the group formally for a graceful shutdown event. * * @param shutdownType shutdown type corresponds to the shutdown types specified * in GMSConstants.shudownType enum. */ private void leave(final GMSConstants.shutdownType shutdownType) { // ensure that only leave the group once. if (hasLeftGroup.compareAndSet(false, true)) { try { logger.log(Level.INFO, "gms.leave", new Object[]{memberName, ctx.getGroupName()}); ctx.leave(shutdownType); removeAllActionFactories(); } finally { hasJoinedGroup.set(false); GMSFactory.removeGMSModule(ctx.getGroupName()); GMSContextFactory.removeGMSContext(ctx.getGroupName()); } } }