private static ConnectionInfo[] getConnectionsFromL1Config(final L1ConfigurationSetupManager configSetupManager) { L2Data[] l2s = null; // synchronized here as same issue of MNK-1984. ArrayIndexOutOfBoundsException in multi threaded environment due to // apache bug https://issues.apache.org/jira/browse/XMLBEANS-328 synchronized (configSetupManager) { l2s = configSetupManager.l2Config().l2Data(); } // clean groupID which is supported to get from L2. for (L2Data l2 : l2s) { l2.setGroupId(0); } ConnectionInfoConfig connectInfo = new ConnectionInfoConfig(l2s, configSetupManager.getSecurityInfo()); return connectInfo.getConnectionInfos(); }
public ConnectionInfoConfig(L2Data[] l2sData, SecurityInfo securityInfo) { this.connectionInfos = createValueFrom(l2sData, securityInfo); }
protected ConnectionAddressProvider createConnectionAddressProvider(final PreparedComponentsFromL2Connection connComp) { final ConnectionInfoConfig connectionInfoItem = connComp.createConnectionInfoConfigItem(); final ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); final ConnectionAddressProvider cap = new ConnectionAddressProvider(connectionInfo); return cap; }
public ConnectionInfoConfig createConnectionInfoConfigItem() { L2Data[] l2s = this.config.l2Config().l2Data(); for (L2Data l2 : l2s) { l2.setGroupId(getGroupID(l2.getGroupName())); } return new ConnectionInfoConfig(l2s, config.getSecurityInfo()); }
protected ConnectionAddressProvider createConnectionAddressProvider(final PreparedComponentsFromL2Connection connComp) { final ConnectionInfoConfig connectionInfoItem = connComp.createConnectionInfoConfigItem(); final ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); final ConnectionAddressProvider cap = new ConnectionAddressProvider(connectionInfo); return cap; }
public ConnectionInfoConfig createConnectionInfoConfigItem() { L2Data[] l2s = this.config.l2Config().l2Data(); for (L2Data l2 : l2s) { l2.setGroupId(getGroupID(l2.getGroupName())); } return new ConnectionInfoConfig(l2s, config.getSecurityInfo()); }
protected ConnectionAddressProvider createConnectionAddressProvider(final PreparedComponentsFromL2Connection connComp) { final ConnectionInfoConfig connectionInfoItem = connComp.createConnectionInfoConfigItem(); final ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); final ConnectionAddressProvider cap = new ConnectionAddressProvider(connectionInfo); return cap; }
private static ConnectionInfo[] getConnectionsFromL1Config(final L1ConfigurationSetupManager configSetupManager) { L2Data[] l2s = null; // synchronized here as same issue of MNK-1984. ArrayIndexOutOfBoundsException in multi threaded environment due to // apache bug https://issues.apache.org/jira/browse/XMLBEANS-328 synchronized (configSetupManager) { l2s = configSetupManager.l2Config().l2Data(); } // clean groupID which is supported to get from L2. for (L2Data l2 : l2s) { l2.setGroupId(0); } ConnectionInfoConfig connectInfo = new ConnectionInfoConfig(l2s, configSetupManager.getSecurityInfo()); return connectInfo.getConnectionInfos(); }
public ConnectionInfoConfig createConnectionInfoConfigItem() { L2Data[] l2s = this.config.l2Config().l2Data(); for (L2Data l2 : l2s) { l2.setGroupId(getGroupID(l2.getGroupName())); } return new ConnectionInfoConfig(l2s, config.getSecurityInfo()); }
public ConnectionInfoConfig(L2Data[] l2sData, SecurityInfo securityInfo) { this.connectionInfos = createValueFrom(l2sData, securityInfo); }
public static ObjectCreationStrategy getObjectCreationStrategy( PreparedComponentsFromL2Connection connectionComponents, OrderedGroupIDs groupIDs, ClientIDProvider cidProvider) { ConnectionInfoConfig[] groupConfigItems = connectionComponents.createConnectionInfoConfigItemByGroup(); Map serverGroups = new HashMap<String, GroupID>(); for (ConnectionInfoConfig groupConfigItem : groupConfigItems) { ConnectionInfo[] connectionInfo = groupConfigItem.getConnectionInfos(); serverGroups.put(connectionInfo[0].getGroupName(), new GroupID(connectionInfo[0].getGroupId())); } if (creationStrategy.toLowerCase().equals("round-robin")) { return new RoundRobinObjectCreationStrategy(groupIDs.getGroupIDs(), cidProvider); } else if (creationStrategy.toLowerCase().equals("group-affinity")) { return new GroupAffinityObjectCreationStrategy(serverGroups); } else { throw new AssertionError("UnSupported Object Creation Strategy - " + creationStrategy + " : Allowed : round-robin/group-affinity"); } }
private static ConnectionInfo[] getConnectionsFromL1Config(final L1ConfigurationSetupManager configSetupManager) { L2Data[] l2s = null; // synchronized here as same issue of MNK-1984. ArrayIndexOutOfBoundsException in multi threaded environment due to // apache bug https://issues.apache.org/jira/browse/XMLBEANS-328 synchronized (configSetupManager) { l2s = configSetupManager.l2Config().l2Data(); } // clean groupID which is supported to get from L2. for (L2Data l2 : l2s) { l2.setGroupId(0); } ConnectionInfoConfig connectInfo = new ConnectionInfoConfig(l2s, configSetupManager.getSecurityInfo()); return connectInfo.getConnectionInfos(); }
public ConnectionInfoConfig[] createConnectionInfoConfigItemByGroup() { /** * this block is synchronized because of the apache bug https://issues.apache.org/jira/browse/XMLBEANS-328. In multi * threaded environment we used to get ArrayIndexOutOfBoundsException See MNK-1984, 2010, 2013 for more details */ synchronized (this.config) { this.config.l2Config().l2Data(); } L2Data[][] l2DataByGroup = this.config.l2Config().getL2DataByGroup(); // set GroupID assigned by L2 // notes: this.config.l2config() has called ActiveCoordinatorHelper.generateGroupNames(), so that to have a right // group name to work with. for (L2Data[] group : l2DataByGroup) { for (L2Data l2 : group) { l2.setGroupId(getGroupID(l2.getGroupName())); } } ConnectionInfoConfig[] items = new ConnectionInfoConfig[l2DataByGroup.length]; for (int i = 0; i < l2DataByGroup.length; i++) { items[i] = new ConnectionInfoConfig(l2DataByGroup[i], config.getSecurityInfo()); } return items; }
public ConnectionInfoConfig(L2Data[] l2sData, SecurityInfo securityInfo) { this.connectionInfos = createValueFrom(l2sData, securityInfo); }
private boolean isImmediate() { // XXX: Race condition here --> we can start the non-immediate shutdown procedure becuase we think the channel is // open, but it can die before we start (or in the middle of) flushing the local work if (channel.isConnected()) { return false; } // If we've connected to a persistent server, we should try to flush if (handshakeManager.serverIsPersistent()) { return false; } // If we think there is more than one server out there, we should try to flush ConnectionInfoConfig connectionInfoItem = this.connectionComponents.createConnectionInfoConfigItem(); ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); return connectionInfo.length == 1; }
public ConnectionInfoConfig[] createConnectionInfoConfigItemByGroup() { /** * this block is synchronized because of the apache bug https://issues.apache.org/jira/browse/XMLBEANS-328. In multi * threaded environment we used to get ArrayIndexOutOfBoundsException See MNK-1984, 2010, 2013 for more details */ synchronized (this.config) { this.config.l2Config().l2Data(); } L2Data[][] l2DataByGroup = this.config.l2Config().getL2DataByGroup(); // set GroupID assigned by L2 // notes: this.config.l2config() has called ActiveCoordinatorHelper.generateGroupNames(), so that to have a right // group name to work with. for (L2Data[] group : l2DataByGroup) { for (L2Data l2 : group) { l2.setGroupId(getGroupID(l2.getGroupName())); } } ConnectionInfoConfig[] items = new ConnectionInfoConfig[l2DataByGroup.length]; for (int i = 0; i < l2DataByGroup.length; i++) { items[i] = new ConnectionInfoConfig(l2DataByGroup[i], config.getSecurityInfo()); } return items; }
private boolean isImmediate() { // XXX: Race condition here --> we can start the non-immediate shutdown procedure becuase we think the channel is // open, but it can die before we start (or in the middle of) flushing the local work if (channel.isConnected()) { return false; } // If we've connected to a persistent server, we should try to flush if (handshakeManager.serverIsPersistent()) { return false; } // If we think there is more than one server out there, we should try to flush ConnectionInfoConfig connectionInfoItem = this.connectionComponents.createConnectionInfoConfigItem(); ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); return connectionInfo.length == 1; }
public ConnectionInfoConfig[] createConnectionInfoConfigItemByGroup() { /** * this block is synchronized because of the apache bug https://issues.apache.org/jira/browse/XMLBEANS-328. In multi * threaded environment we used to get ArrayIndexOutOfBoundsException See MNK-1984, 2010, 2013 for more details */ synchronized (this.config) { this.config.l2Config().l2Data(); } L2Data[][] l2DataByGroup = this.config.l2Config().getL2DataByGroup(); // set GroupID assigned by L2 // notes: this.config.l2config() has called ActiveCoordinatorHelper.generateGroupNames(), so that to have a right // group name to work with. for (L2Data[] group : l2DataByGroup) { for (L2Data l2 : group) { l2.setGroupId(getGroupID(l2.getGroupName())); } } ConnectionInfoConfig[] items = new ConnectionInfoConfig[l2DataByGroup.length]; for (int i = 0; i < l2DataByGroup.length; i++) { items[i] = new ConnectionInfoConfig(l2DataByGroup[i], config.getSecurityInfo()); } return items; }
private boolean isImmediate() { // XXX: Race condition here --> we can start the non-immediate shutdown procedure becuase we think the channel is // open, but it can die before we start (or in the middle of) flushing the local work if (channel.isConnected()) { return false; } // If we've connected to a persistent server, we should try to flush if (handshakeManager.serverIsPersistent()) { return false; } // If we think there is more than one server out there, we should try to flush ConnectionInfoConfig connectionInfoItem = this.connectionComponents.createConnectionInfoConfigItem(); ConnectionInfo[] connectionInfo = connectionInfoItem.getConnectionInfos(); return connectionInfo.length == 1; }
public static ObjectCreationStrategy getObjectCreationStrategy( PreparedComponentsFromL2Connection connectionComponents, OrderedGroupIDs groupIDs, ClientIDProvider cidProvider) { ConnectionInfoConfig[] groupConfigItems = connectionComponents.createConnectionInfoConfigItemByGroup(); Map serverGroups = new HashMap<String, GroupID>(); for (ConnectionInfoConfig groupConfigItem : groupConfigItems) { ConnectionInfo[] connectionInfo = groupConfigItem.getConnectionInfos(); serverGroups.put(connectionInfo[0].getGroupName(), new GroupID(connectionInfo[0].getGroupId())); } if (creationStrategy.toLowerCase().equals("round-robin")) { return new RoundRobinObjectCreationStrategy(groupIDs.getGroupIDs(), cidProvider); } else if (creationStrategy.toLowerCase().equals("group-affinity")) { return new GroupAffinityObjectCreationStrategy(serverGroups); } else { throw new AssertionError("UnSupported Object Creation Strategy - " + creationStrategy + " : Allowed : round-robin/group-affinity"); } }