/**
* Copyright (c) 2014 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.controller.sal.compatibility;
-import com.google.common.base.Objects;
-import com.google.common.base.Preconditions;
-import org.eclipse.xtext.xbase.lib.Exceptions;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+
import org.opendaylight.controller.sal.common.util.Arguments;
import org.opendaylight.controller.sal.core.AdvertisedBandwidth;
import org.opendaylight.controller.sal.core.Bandwidth;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
-@SuppressWarnings("all")
-public class NodeMapping {
+public final class NodeMapping {
public final static String MD_SAL_TYPE = "MD_SAL";
-
+
private final static Class<Node> NODE_CLASS = Node.class;
-
+
private final static Class<NodeConnector> NODECONNECTOR_CLASS = NodeConnector.class;
-
+
private NodeMapping() {
throw new UnsupportedOperationException("Utility class. Instantiation is not allowed.");
}
-
+
public static org.opendaylight.controller.sal.core.Node toADNode(final InstanceIdentifier<? extends Object> node) throws ConstructionException {
NodeId nodeId = NodeMapping.toNodeId(node);
return NodeMapping.toADNode(nodeId);
}
-
- public static org.opendaylight.controller.sal.core.Node toADNode(final NodeId id) {
- try {
+
+ public static org.opendaylight.controller.sal.core.Node toADNode(final NodeId id) throws ConstructionException {
String aDNodeId = NodeMapping.toADNodeId(id);
return new org.opendaylight.controller.sal.core.Node(NodeMapping.MD_SAL_TYPE, aDNodeId);
- } catch (Throwable e) {
- throw Exceptions.sneakyThrow(e);
- }
}
-
+
public static NodeId toNodeId(final InstanceIdentifier<? extends Object> node) {
Preconditions.<InstanceIdentifier<? extends Object>>checkNotNull(node);
List<PathArgument> path = node.getPath();
Preconditions.checkArgument(size >= 2);
final PathArgument arg = path.get(1);
final IdentifiableItem item = Arguments.<IdentifiableItem>checkInstanceOf(arg, IdentifiableItem.class);
- Identifier key = item.getKey();
+ Identifier<?> key = item.getKey();
final NodeKey nodeKey = Arguments.<NodeKey>checkInstanceOf(key, NodeKey.class);
return nodeKey.getId();
}
-
+
public static String toADNodeId(final NodeId nodeId) {
Preconditions.<NodeId>checkNotNull(nodeId);
return nodeId.getValue();
}
-
+
public static org.opendaylight.controller.sal.core.NodeConnector toADNodeConnector(final NodeConnectorRef source) throws ConstructionException {
Preconditions.<NodeConnectorRef>checkNotNull(source);
final InstanceIdentifier<?> path = Preconditions.<InstanceIdentifier<? extends Object>>checkNotNull(source.getValue());
final NodeConnectorKey connectorKey = Arguments.<NodeConnectorKey>checkInstanceOf(item.getKey(), NodeConnectorKey.class);
return NodeMapping.toADNodeConnector(connectorKey.getId(), NodeMapping.toNodeId(path));
}
-
- public static org.opendaylight.controller.sal.core.NodeConnector toADNodeConnector(final NodeConnectorId ncid, final NodeId nid) {
- try {
- String nodeConnectorType = NodeMapping.toNodeConnectorType(ncid, nid);
- Object aDNodeConnectorId = NodeMapping.toADNodeConnectorId(ncid, nid);
- org.opendaylight.controller.sal.core.Node aDNode = NodeMapping.toADNode(nid);
- return new org.opendaylight.controller.sal.core.NodeConnector(nodeConnectorType, aDNodeConnectorId, aDNode);
- } catch (Throwable e) {
- throw Exceptions.sneakyThrow(e);
- }
+
+ public static org.opendaylight.controller.sal.core.NodeConnector toADNodeConnector(final NodeConnectorId ncid, final NodeId nid) throws ConstructionException {
+ String nodeConnectorType = NodeMapping.toNodeConnectorType(ncid, nid);
+ Object aDNodeConnectorId = NodeMapping.toADNodeConnectorId(ncid, nid);
+ org.opendaylight.controller.sal.core.Node aDNode = NodeMapping.toADNode(nid);
+ return new org.opendaylight.controller.sal.core.NodeConnector(nodeConnectorType, aDNodeConnectorId, aDNode);
}
-
+
public static String toNodeConnectorType(final NodeConnectorId ncId, final NodeId nodeId) {
if (ncId.equals(toLocalNodeConnectorId(nodeId))) {
return NodeConnectorIDType.SWSTACK;
}
return nodeConnectorId.getValue();
}
-
+
public static NodeConnectorId toControllerNodeConnectorId(final NodeId node) {
return new NodeConnectorId(node.getValue() + ":" + 4294967293L);
}
-
+
public static NodeConnectorId toLocalNodeConnectorId(final NodeId node) {
return new NodeConnectorId(node.getValue() + ":" + 4294967294L);
}
-
+
public static NodeConnectorId toNormalNodeConnectorId(final NodeId node) {
return new NodeConnectorId(node.getValue() + ":" + 4294967290L);
}
-
+
public static NodeRef toNodeRef(final org.opendaylight.controller.sal.core.Node node) {
Preconditions.checkArgument(MD_SAL_TYPE.equals(node.getType()));
final String nodeId = Arguments.<String>checkInstanceOf(node.getID(), String.class);
final InstanceIdentifier<Node> nodePath = InstanceIdentifier.builder(Nodes.class).child(NODE_CLASS, nodeKey).toInstance();
return new NodeRef(nodePath);
}
-
+
public static NodeConnectorRef toNodeConnectorRef(final org.opendaylight.controller.sal.core.NodeConnector nodeConnector) {
final NodeRef node = NodeMapping.toNodeRef(nodeConnector.getNode());
final InstanceIdentifier<NodeConnector> path = InstanceIdentifier.builder(nodePath).child(NODECONNECTOR_CLASS, connectorKey).toInstance();
return new NodeConnectorRef(path);
}
-
+
public static org.opendaylight.controller.sal.core.Node toADNode(final NodeRef node) throws ConstructionException {
return NodeMapping.toADNode(node.getValue());
}
-
+
public static HashSet<Property> toADNodeConnectorProperties(final NodeConnectorUpdated nc) {
final FlowCapableNodeConnectorUpdated fcncu = nc.<FlowCapableNodeConnectorUpdated>getAugmentation(FlowCapableNodeConnectorUpdated.class);
if (!Objects.equal(fcncu, null)) {
}
return new HashSet<Property>();
}
-
+
public static HashSet<Property> toADNodeConnectorProperties(final NodeConnector nc) {
final FlowCapableNodeConnector fcnc = nc.<FlowCapableNodeConnector>getAugmentation(FlowCapableNodeConnector.class);
if (!Objects.equal(fcnc, null)) {
}
return new HashSet<Property>();
}
-
+
public static HashSet<Property> toADNodeConnectorProperties(final FlowNodeConnector fcncu) {
final HashSet<org.opendaylight.controller.sal.core.Property> props = new HashSet<>();
}
return props;
}
-
+
public static Name toAdName(final String name) {
return new Name(name);
}
-
+
public static Config toAdConfig(final PortConfig pc) {
Config config = null;
if (pc.isPORTDOWN()) {
}
return config;
}
-
+
public static org.opendaylight.controller.sal.core.State toAdState(final State s) {
org.opendaylight.controller.sal.core.State state = null;
}
return state;
}
-
+
public static Bandwidth toAdBandwidth(final PortFeatures pf) {
Bandwidth bw = null;
if (pf.isTenMbHd() || pf.isTenMbFd()) {
}
return bw;
}
-
+
public static AdvertisedBandwidth toAdAdvertizedBandwidth(final PortFeatures pf) {
AdvertisedBandwidth abw = null;
final Bandwidth bw = toAdBandwidth(pf);
}
return abw;
}
-
+
public static SupportedBandwidth toAdSupportedBandwidth(final PortFeatures pf) {
SupportedBandwidth sbw = null;
final Bandwidth bw = toAdBandwidth(pf);
}
return sbw;
}
-
+
public static PeerBandwidth toAdPeerBandwidth(final PortFeatures pf) {
PeerBandwidth pbw = null;
final Bandwidth bw = toAdBandwidth(pf);
}
return pbw;
}
-
+
public static HashSet<Property> toADNodeProperties(final NodeUpdated nu) {
final FlowCapableNodeUpdated fcnu = nu.getAugmentation(FlowCapableNodeUpdated.class);
if (fcnu != null) {
}
return new HashSet<org.opendaylight.controller.sal.core.Property>();
}
-
+
public static HashSet<Property> toADNodeProperties(final FlowNode fcnu, final NodeId id) {
final HashSet<org.opendaylight.controller.sal.core.Property> props = new HashSet<>();
}
return props;
}
-
+
public static TimeStamp toADTimestamp() {
final Date date = new Date();
final TimeStamp timestamp = new TimeStamp(date.getTime(), "connectedSince");
return timestamp;
}
-
+
public static MacAddress toADMacAddress(final NodeId id) {
final String nodeId = id.getValue().replaceAll("openflow:", "");
long lNodeId = Long.parseLong(nodeId);
byte[] bytesFromDpid = ToSalConversionsUtils.bytesFromDpid(lNodeId);
return new MacAddress(bytesFromDpid);
}
-
+
public static Tables toADTables(final Short tables) {
return new Tables(tables.byteValue());
}
-
+
public static Capabilities toADCapabiliities(final List<Class<? extends FeatureCapability>> capabilities) {
int b = 0;
}
return new Capabilities(b);
}
-
+
public static Buffers toADBuffers(final Long buffers) {
return new Buffers(buffers.intValue());
}
import javax.annotation.Nullable;
-import org.eclipse.xtext.xbase.lib.Exceptions;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@Nullable
@Override
public Optional<DataObject> apply(@Nullable final Optional<NormalizedNode<?, ?>> normalizedNode) {
- try {
- final DataObject dataObject = normalizedNode.isPresent() ? codec.toBinding(path,
- normalizedNode.get()) : null;
+ if (normalizedNode.isPresent()) {
+ final DataObject dataObject;
+ try {
+ dataObject = codec.toBinding(path, normalizedNode.get());
+ } catch (DeserializationException e) {
+ LOG.warn("Failed to create dataobject from node {}", normalizedNode.get(), e);
+ throw new IllegalStateException("Failed to create dataobject", e);
+ }
+
if (dataObject != null) {
updateCache(store, path, dataObject);
+ return Optional.of(dataObject);
}
- return Optional.fromNullable(dataObject);
- } catch (DeserializationException e) {
- Exceptions.sneakyThrow(e);
}
- return null;
+ return Optional.absent();
}
});
}
final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = codec
.toNormalizedNode(path, data);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
- ensureParentsByMerge(writeTransaction, store, normalized.getKey(), path);
- LOG.debug("Tx: {} : Putting data {}",getDelegate().getIdentifier(),normalized.getKey());
- writeTransaction.put(store, normalized.getKey(), normalized.getValue());
+ final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
+ ensureParentsByMerge(writeTransaction, store, normalizedPath, path);
+ LOG.debug("Tx: {} : Putting data {}", getDelegate().getIdentifier(), normalizedPath);
+ writeTransaction.put(store, normalizedPath, normalized.getValue());
}
protected void doMergeWithEnsureParents(final DOMDataReadWriteTransaction writeTransaction,
final Entry<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, NormalizedNode<?, ?>> normalized = codec
.toNormalizedNode(path, data);
- org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
- ensureParentsByMerge(writeTransaction, store, normalized.getKey(), path);
- LOG.debug("Tx: {} : Merge data {}",getDelegate().getIdentifier(),normalized.getKey());
- writeTransaction.merge(store, normalized.getKey(), normalized.getValue());
+ final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier normalizedPath = normalized.getKey();
+ ensureParentsByMerge(writeTransaction, store, normalizedPath, path);
+ LOG.debug("Tx: {} : Merge data {}",getDelegate().getIdentifier(),normalizedPath);
+ writeTransaction.merge(store, normalizedPath, normalized.getValue());
}
private void ensureParentsByMerge(final DOMDataReadWriteTransaction writeTransaction,
*/
package org.opendaylight.controller.sal.binding.codegen;
-import com.google.common.base.Objects;
import java.lang.reflect.Field;
import java.util.Map;
-import org.eclipse.xtext.xbase.lib.Exceptions;
-import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeSpecification;
+
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
-@SuppressWarnings("all")
-public class RuntimeCodeHelper {
- /**
- * Helper method to return delegate from ManagedDirectedProxy with use of reflection.
- *
- * Note: This method uses reflection, but access to delegate field should be
- * avoided and called only if neccessary.
- */
- public static <T extends RpcService> T getDelegate(final RpcService proxy) {
- try {
- Class<? extends RpcService> _class = proxy.getClass();
- final Field field = _class.getField(RuntimeCodeSpecification.DELEGATE_FIELD);
- boolean _equals = Objects.equal(field, null);
- if (_equals) {
- UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Unable to get delegate from proxy");
- throw _unsupportedOperationException;
- }
- try {
- Object _get = field.get(proxy);
- return ((T) _get);
- } catch (Throwable _e) {
- throw Exceptions.sneakyThrow(_e);
- }
- } catch (Throwable _e_1) {
- throw Exceptions.sneakyThrow(_e_1);
+public final class RuntimeCodeHelper {
+ private RuntimeCodeHelper() {
+ throw new UnsupportedOperationException("Utility class should never be instantiated");
+ }
+
+ private static Field getField(final Class<?> cls, final String name) {
+ try {
+ return cls.getField(name);
+ } catch (NoSuchFieldException e) {
+ throw new IllegalArgumentException(
+ String.format("Class %s is missing field %s", cls, name), e);
+ } catch (SecurityException e) {
+ throw new IllegalStateException(String.format("Failed to examine class %s", cls), e);
+ }
}
- }
- /**
- * Helper method to set delegate to ManagedDirectedProxy with use of reflection.
- *
- * Note: This method uses reflection, but setting delegate field should not occur too much
- * to introduce any significant performance hits.
- */
- public static void setDelegate(final RpcService proxy, final RpcService delegate) {
- try {
- Class<? extends RpcService> _class = proxy.getClass();
- final Field field = _class.getField(RuntimeCodeSpecification.DELEGATE_FIELD);
- boolean _equals = Objects.equal(field, null);
- if (_equals) {
- UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Unable to set delegate to proxy");
- throw _unsupportedOperationException;
- }
- boolean _or = false;
- boolean _equals_1 = Objects.equal(delegate, null);
- if (_equals_1) {
- _or = true;
- } else {
- Class<? extends Object> _type = field.getType();
- Class<? extends RpcService> _class_1 = delegate.getClass();
- boolean _isAssignableFrom = _type.isAssignableFrom(_class_1);
- _or = (_equals_1 || _isAssignableFrom);
- }
- if (_or) {
- field.set(proxy, delegate);
- } else {
- IllegalArgumentException _illegalArgumentException = new IllegalArgumentException("delegate class is not assignable to proxy");
- throw _illegalArgumentException;
- }
- } catch (Throwable _e) {
- throw Exceptions.sneakyThrow(_e);
+ private static Field getDelegateField(final Class<?> cls) {
+ return getField(cls, RuntimeCodeSpecification.DELEGATE_FIELD);
}
- }
- /**
- * Helper method to set delegate to ManagedDirectedProxy with use of reflection.
- *
- * Note: This method uses reflection, but setting delegate field should not occur too much
- * to introduce any significant performance hits.
- */
- public static void setDelegate(final Object proxy, final Object delegate) {
- try {
- Class<? extends Object> _class = proxy.getClass();
- final Field field = _class.getField(RuntimeCodeSpecification.DELEGATE_FIELD);
- boolean _equals = Objects.equal(field, null);
- if (_equals) {
- UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException("Unable to set delegate to proxy");
- throw _unsupportedOperationException;
- }
- boolean _or = false;
- boolean _equals_1 = Objects.equal(delegate, null);
- if (_equals_1) {
- _or = true;
- } else {
- Class<? extends Object> _type = field.getType();
- Class<? extends Object> _class_1 = delegate.getClass();
- boolean _isAssignableFrom = _type.isAssignableFrom(_class_1);
- _or = (_equals_1 || _isAssignableFrom);
- }
- if (_or) {
- field.set(proxy, delegate);
- } else {
- IllegalArgumentException _illegalArgumentException = new IllegalArgumentException("delegate class is not assignable to proxy");
- throw _illegalArgumentException;
- }
- } catch (Throwable _e) {
- throw Exceptions.sneakyThrow(_e);
+ private static Object getFieldValue(final Field field, final Object obj) {
+ try {
+ return field.get(obj);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(String.format("Failed to get field %s of object %s", field, obj), e);
+ }
+ }
+
+ private static void setFieldValue(final Field field, final Object obj, final Object value) {
+ try {
+ field.set(obj, value);
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(String.format("Failed to set field %s to %s", field, value), e);
+ }
+ }
+
+ /**
+ * Helper method to return delegate from ManagedDirectedProxy with use of reflection.
+ *
+ * Note: This method uses reflection, but access to delegate field should be
+ * avoided and called only if necessary.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends RpcService> T getDelegate(final RpcService proxy) {
+ return (T)getFieldValue(getDelegateField(proxy.getClass()), proxy);
+ }
+
+ /**
+ * Helper method to set delegate to ManagedDirectedProxy with use of reflection.
+ *
+ * Note: This method uses reflection, but setting delegate field should not occur too much
+ * to introduce any significant performance hits.
+ */
+ public static void setDelegate(final Object proxy, final Object delegate) {
+ final Field field = getDelegateField(proxy.getClass());
+
+ if (delegate != null) {
+ final Class<?> ft = field.getType();
+ if (!ft.isAssignableFrom(delegate.getClass())) {
+ throw new IllegalArgumentException(
+ String.format("Field %s type %s is not compatible with delegate type %s",
+ field, ft, delegate.getClass()));
+ }
+ }
+
+ setFieldValue(field, proxy, delegate);
}
- }
- public static Map<InstanceIdentifier<? extends Object>,? extends RpcService> getRoutingTable(final RpcService target, final Class<? extends BaseIdentity> tableClass) {
- try {
- Class<? extends RpcService> _class = target.getClass();
- String _routingTableField = RuntimeCodeSpecification.getRoutingTableField(tableClass);
- final Field field = _class.getField(_routingTableField);
- boolean _equals = Objects.equal(field, null);
- if (_equals) {
- UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException(
- "Unable to get routing table. Table field does not exists");
- throw _unsupportedOperationException;
- }
- try {
- Object _get = field.get(target);
- return ((Map<InstanceIdentifier<? extends Object>,? extends RpcService>) _get);
- } catch (Throwable _e) {
- throw Exceptions.sneakyThrow(_e);
- }
- } catch (Throwable _e_1) {
- throw Exceptions.sneakyThrow(_e_1);
+ @SuppressWarnings("unchecked")
+ public static Map<InstanceIdentifier<? extends Object>,? extends RpcService> getRoutingTable(final RpcService target, final Class<? extends BaseIdentity> tableClass) {
+ final Field field = getField(target.getClass(), RuntimeCodeSpecification.getRoutingTableField(tableClass));
+ return (Map<InstanceIdentifier<? extends Object>,? extends RpcService>) getFieldValue(field, target);
}
- }
- public static void setRoutingTable(final RpcService target, final Class<? extends BaseIdentity> tableClass, final Map<InstanceIdentifier<? extends Object>,? extends RpcService> routingTable) {
- try {
- Class<? extends RpcService> _class = target.getClass();
- String _routingTableField = RuntimeCodeSpecification.getRoutingTableField(tableClass);
- final Field field = _class.getField(_routingTableField);
- boolean _equals = Objects.equal(field, null);
- if (_equals) {
- UnsupportedOperationException _unsupportedOperationException = new UnsupportedOperationException(
- "Unable to set routing table. Table field does not exists");
- throw _unsupportedOperationException;
- }
- field.set(target, routingTable);
- } catch (Throwable _e) {
- throw Exceptions.sneakyThrow(_e);
+ public static void setRoutingTable(final RpcService target, final Class<? extends BaseIdentity> tableClass, final Map<InstanceIdentifier<? extends Object>,? extends RpcService> routingTable) {
+ final Field field = getField(target.getClass(), RuntimeCodeSpecification.getRoutingTableField(tableClass));
+ setFieldValue(field, target, routingTable);
}
- }
-}
\ No newline at end of file
+}
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import org.eclipse.xtext.xbase.lib.Exceptions;
import org.opendaylight.controller.md.sal.common.api.RegistrationListener;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
}
protected ImmutableList<DataCommitHandler<P, D>> affectedCommitHandlers(final Set<P> paths) {
- final Callable<ImmutableList<DataCommitHandler<P, D>>> _function = new Callable<ImmutableList<DataCommitHandler<P, D>>>() {
+ final Supplier<ImmutableList<DataCommitHandler<P, D>>> _function = new Supplier<ImmutableList<DataCommitHandler<P, D>>>() {
@Override
- public ImmutableList<DataCommitHandler<P, D>> call() throws Exception {
+ public ImmutableList<DataCommitHandler<P, D>> get() {
Map<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _asMap = commitHandlers.asMap();
Set<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _entrySet = _asMap.entrySet();
FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _from = FluentIterable
}
protected ImmutableList<DataCommitHandler<P, D>> probablyAffectedCommitHandlers(final HashSet<P> paths) {
- final Callable<ImmutableList<DataCommitHandler<P, D>>> _function = new Callable<ImmutableList<DataCommitHandler<P, D>>>() {
+ final Supplier<ImmutableList<DataCommitHandler<P, D>>> _function = new Supplier<ImmutableList<DataCommitHandler<P, D>>>() {
@Override
- public ImmutableList<DataCommitHandler<P, D>> call() throws Exception {
+ public ImmutableList<DataCommitHandler<P, D>> get() {
Map<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>> _asMap = commitHandlers.asMap();
Set<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _entrySet = _asMap.entrySet();
FluentIterable<Entry<P, Collection<DataCommitHandlerRegistrationImpl<P, D>>>> _from = FluentIterable
return _dataReadRouter.readOperationalData(path);
}
- private static <T extends Object> T withLock(final Lock lock, final Callable<T> method) {
+ private static <T extends Object> T withLock(final Lock lock, final Supplier<T> method) {
lock.lock();
try {
- return method.call();
- } catch (Exception e) {
- throw Exceptions.sneakyThrow(e);
+ return method.get();
} finally {
lock.unlock();
}