/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
String getNullableTransactionName();
- ServiceReferenceJMXRegistration registerMBean(ServiceReferenceMXBeanImpl object,
- ObjectName on) throws InstanceAlreadyExistsException;
+ ServiceReferenceJMXRegistration registerMBean(ServiceReferenceMXBeanImpl object, ObjectName on)
+ throws InstanceAlreadyExistsException;
@Override
void close();
private final InternalJMXRegistrator currentJMXRegistrator;
private final String nullableTransactionName;
- public ServiceReferenceRegistratorImpl(final NestableJMXRegistrator parentRegistrator, final String nullableTransactionName){
+ public ServiceReferenceRegistratorImpl(final NestableJMXRegistrator parentRegistrator,
+ final String nullableTransactionName) {
currentJMXRegistrator = parentRegistrator.createChild();
this.nullableTransactionName = nullableTransactionName;
}
return nullableTransactionName;
}
-
@Override
public ServiceReferenceJMXRegistration registerMBean(final ServiceReferenceMXBeanImpl object,
- final ObjectName on) throws InstanceAlreadyExistsException {
+ final ObjectName on) throws InstanceAlreadyExistsException {
String actualTransactionName = ObjectNameUtil.getTransactionName(on);
boolean broken = false;
- broken |= (nullableTransactionName == null) != (actualTransactionName == null);
- broken |= (nullableTransactionName != null) && !nullableTransactionName.equals(actualTransactionName);
+ broken |= nullableTransactionName == null != (actualTransactionName == null);
+ broken |= nullableTransactionName != null && !nullableTransactionName.equals(actualTransactionName);
if (broken) {
throw new IllegalArgumentException("Transaction name mismatch between expected "
+ nullableTransactionName + ", got " + actualTransactionName + " in " + on);
return new ServiceReferenceJMXRegistration(currentJMXRegistrator.registerMBean(object, on));
}
-
@Override
public void close() {
currentJMXRegistrator.close();
}
+
public interface ServiceReferenceTransactionRegistratorFactory {
ServiceReferenceRegistrator create();
}
}
-
class ServiceReferenceTransactionRegistratorFactoryImpl implements ServiceReferenceTransactionRegistratorFactory {
private final NestableJMXRegistrator parentRegistrator;
private final String nullableTransactionName;
- public ServiceReferenceTransactionRegistratorFactoryImpl(final TransactionModuleJMXRegistrator parentRegistrator,
- final String nullableTransactionName) {
+ public ServiceReferenceTransactionRegistratorFactoryImpl(
+ final TransactionModuleJMXRegistrator parentRegistrator, final String nullableTransactionName) {
this.parentRegistrator = parentRegistrator;
this.nullableTransactionName = nullableTransactionName;
}