unmarshaller.init(engineServiceHandler);
}
- // Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to
- // traverse the unmarshalers because the
- // unmarshalers and marshalers are paired one to one uniquely so if we find a
- // synchronized unmarshaler we'll also find its
- // paired marshaler
- for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters()
- .entrySet()) {
- final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey());
-
- // Pair up peered unmarshalers and marshalers
- for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) {
- // Check if the unmarshaler is synchronized with a marshaler
- if (inputParameters.getValue().isPeeredMode(peeredMode)) {
- // Find the unmarshaler and marshaler
- final ApexEventMarshaller peeredMarshaler =
- marshallerMap.get(inputParameters.getValue().getPeer(peeredMode));
-
- // Connect the unmarshaler and marshaler
- unmarshaller.connectMarshaler(peeredMode, peeredMarshaler);
- }
- }
- // Now let's get events flowing
- unmarshaller.start();
- }
+ setUpmarshalerPairings();
} catch (final Exception e) {
LOGGER.debug("Apex engine failed to start as a service", e);
throw new ApexActivatorException("Apex engine failed to start as a service", e);
LOGGER.debug("Apex engine started as a service");
}
+ /**
+ * Set up unmarshaler/marshaler pairing for synchronized event handling. We only need to
+ * traverse the unmarshalers because the
+ * unmarshalers and marshalers are paired one to one uniquely so if we find a
+ * synchronized unmarshaler we'll also find its
+ * paired marshaler
+ */
+ private void setUpmarshalerPairings() {
+ for (final Entry<String, EventHandlerParameters> inputParameters : apexParameters.getEventInputParameters()
+ .entrySet()) {
+ final ApexEventUnmarshaller unmarshaller = unmarshallerMap.get(inputParameters.getKey());
+
+ // Pair up peered unmarshalers and marshalers
+ for (final EventHandlerPeeredMode peeredMode : EventHandlerPeeredMode.values()) {
+ // Check if the unmarshaler is synchronized with a marshaler
+ if (inputParameters.getValue().isPeeredMode(peeredMode)) {
+ // Find the unmarshaler and marshaler
+ final ApexEventMarshaller peeredMarshaler =
+ marshallerMap.get(inputParameters.getValue().getPeer(peeredMode));
+
+ // Connect the unmarshaler and marshaler
+ unmarshaller.connectMarshaler(peeredMode, peeredMarshaler);
+ }
+ }
+ // Now let's get events flowing
+ unmarshaller.start();
+ }
+ }
+
/**
* Terminate the Apex engine.
*
private final File zookeeperDirectory;
private final int zookeeperPort;
- /**
- * The main method.
- *
- * @param args the args
- * @throws Exception the exception
- */
- public static void main(final String[] args) throws Exception {
- if (args.length != NUM_ARGS) {
- String errorMessage = "Args: " + Arrays.toString(args)
- + "\nusage: testLabel jvmCount threadCount threadLoops longArraySize lockType "
- + "zookeeperAddress zookeeperPort zookeeperDirectory";
- LOGGER.info(errorMessage);
- return;
- }
-
- final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(args[ARG_LABEL],
- Integer.valueOf(args[ARG_JVM_COUNT]), Integer.valueOf(args[ARG_THREAD_COUNT]),
- Integer.valueOf(args[ARG_ITERATIONS]), Integer.valueOf(args[ARG_ARRAY_SIZE]),
- Integer.valueOf(args[ARG_LOCK_TYPE]));
-
- final ConcurrentContextMetrics concurrentContextMetrics = new ConcurrentContextMetrics(configrationProvider,
- args[ARG_ZOOKEEPER_ADDRESS], Integer.valueOf(args[ARG_ZOOKEEPER_PORT]),
- args[ARG_ZOOKEEPER_DIRECTORY]);
-
- concurrentContextMetrics.concurrentContextMetricsJvmLocal();
- concurrentContextMetrics.concurrentContextMetricsCurator();
- concurrentContextMetrics.concurrentContextMetricsHazelcast();
- concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmHazelcastLock();
- concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmHazelcastlock();
- concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmCuratorLock();
- concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmCuratorLock();
- }
-
/**
* Construct a concurrent context object.
*
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsJvmLocal() throws IOException, ApexException {
+ private void concurrentContextMetricsJvmLocal() throws ApexException {
if (configrationProvider.getJvmCount() != 1) {
return;
}
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsHazelcast() throws IOException, ApexException {
+ private void concurrentContextMetricsHazelcast() throws ApexException {
if (configrationProvider.getJvmCount() != 1) {
return;
}
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsCurator() throws IOException, ApexException {
+ private void concurrentContextMetricsCurator() throws ApexException {
if (configrationProvider.getJvmCount() != 1) {
return;
}
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsHazelcastMultiJvmHazelcastLock() throws IOException, ApexException {
+ private void concurrentContextMetricsHazelcastMultiJvmHazelcastLock() throws ApexException {
LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics . . .");
final ContextParameters contextParameters = new ContextParameters();
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsInfinispanMultiJvmHazelcastlock() throws IOException, ApexException {
+ private void concurrentContextMetricsInfinispanMultiJvmHazelcastlock() throws ApexException {
LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics . . .");
final ContextParameters contextParameters = new ContextParameters();
* @throws InterruptedException on interrupts
*/
private void concurrentContextMetricsInfinispanMultiJvmCuratorLock()
- throws IOException, ApexException, InterruptedException {
+ throws ApexException {
LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics . . .");
* @throws InterruptedException on interrupts
*/
private void concurrentContextMetricsHazelcastMultiJvmCuratorLock()
- throws IOException, ApexException, InterruptedException {
+ throws ApexException {
LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics . . .");
final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider = new ZooKeeperServerServiceProvider(
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void runConcurrentContextMetrics(final String testName) throws IOException, ApexException {
+ private void runConcurrentContextMetrics(final String testName) throws ApexException {
final ConcurrentContext concurrentContext = new ConcurrentContext(configrationProvider);
LOGGER.info("Running {} ...", testName);
LOGGER.info("Completed {} ...", testName);
}
+ /**
+ * The main method.
+ *
+ * @param args the args
+ * @throws Exception the exception
+ */
+ public static void main(final String[] args) throws Exception {
+ if (args.length != NUM_ARGS) {
+ String errorMessage = "Args: " + Arrays.toString(args)
+ + "\nusage: testLabel jvmCount threadCount threadLoops longArraySize lockType "
+ + "zookeeperAddress zookeeperPort zookeeperDirectory";
+ LOGGER.info(errorMessage);
+ return;
+ }
+
+ final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(args[ARG_LABEL],
+ Integer.valueOf(args[ARG_JVM_COUNT]), Integer.valueOf(args[ARG_THREAD_COUNT]),
+ Integer.valueOf(args[ARG_ITERATIONS]), Integer.valueOf(args[ARG_ARRAY_SIZE]),
+ Integer.valueOf(args[ARG_LOCK_TYPE]));
+
+ final ConcurrentContextMetrics concurrentContextMetrics = new ConcurrentContextMetrics(configrationProvider,
+ args[ARG_ZOOKEEPER_ADDRESS], Integer.valueOf(args[ARG_ZOOKEEPER_PORT]),
+ args[ARG_ZOOKEEPER_DIRECTORY]);
+
+ concurrentContextMetrics.concurrentContextMetricsJvmLocal();
+ concurrentContextMetrics.concurrentContextMetricsCurator();
+ concurrentContextMetrics.concurrentContextMetricsHazelcast();
+ concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmHazelcastLock();
+ concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmHazelcastlock();
+ concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmCuratorLock();
+ concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmCuratorLock();
+ }
}