/** Creates an instance of {@code AccessedObjectImpl}. */ AccessedObjectImpl( Object objId, AccessType type, String source, AccessedObjectsDetailImpl parent) { Objects.checkNull("objId", objId); Objects.checkNull("type", type); Objects.checkNull("source", source); Objects.checkNull("parent", parent); this.objId = objId; this.type = type; this.source = source; this.parent = parent; }
/** {@inheritDoc} */ public void setObjectDescription(Transaction txn, T objId, Object description) { Objects.checkNull("txn", txn); Objects.checkNull("objId", objId); AccessedObjectsDetailImpl detail = txnMap.get(txn); if (detail == null) { throw new IllegalArgumentException("Unknown transaction: " + txn); } if (description != null) { detail.setDescription(source, objId, description); } }
/** {@inheritDoc} */ public void reportObjectAccess(Transaction txn, T objId, AccessType type, Object description) { Objects.checkNull("txn", txn); Objects.checkNull("objId", objId); Objects.checkNull("type", type); AccessedObjectsDetailImpl detail = txnMap.get(txn); if (detail == null) { throw new IllegalArgumentException("Unknown transaction: " + txn); } detail.addAccess(new AccessedObjectImpl(objId, type, source, detail)); if (description != null) { detail.setDescription(source, objId, description); } }
/** {@inheritDoc} */ public Transaction getConflictingTransaction(Transaction txn) { Objects.checkNull("txn", txn); // given that we're not actively managing contention yet (which // means that there aren't many active conflicts) and the scheduler // isn't trying to optimize using this interface, we don't try // to track these cases yet return null; }
/** * Returns the protocol descriptors map, keyed by node ID. Creates and stores the map if it * doesn't already exist. This method must be run within a transaction. */ private static Map<Long, Set<ProtocolDescriptor>> getProtocolDescriptorsMap() { DataService dataService = getDataService(); Map<Long, Set<ProtocolDescriptor>> protocolDescriptorsMap; try { protocolDescriptorsMap = Objects.uncheckedCast(dataService.getServiceBinding(PROTOCOL_DESCRIPTORS_MAP_KEY)); } catch (NameNotBoundException e) { protocolDescriptorsMap = new ScalableHashMap<Long, Set<ProtocolDescriptor>>(); dataService.setServiceBinding(PROTOCOL_DESCRIPTORS_MAP_KEY, protocolDescriptorsMap); } return protocolDescriptorsMap; }
/** * Creates an instance of {@code TrackingAccessCoordinator}. * * @throws IllegalArgumentException if the requested backlog queue size is not a valid number * greater than 0 */ TrackingAccessCoordinator( Properties properties, TransactionProxy txnProxy, ProfileCollectorHandle profileCollector) { super(txnProxy, profileCollector); Objects.checkNull("properties", properties); String backlogProp = properties.getProperty(BACKLOG_QUEUE_PROPERTY); if (backlogProp != null) { try { backlog = new LinkedBlockingQueue<AccessedObjectsDetailImpl>(Integer.parseInt(backlogProp)); } catch (NumberFormatException nfe) { throw new IllegalArgumentException( "Backlog size must be a " + "positive number: " + backlogProp); } } else { backlog = null; } }
/** {@inheritDoc} */ public <T> AccessReporter<T> registerAccessSource(String sourceName, Class<T> objectIdType) { Objects.checkNull("sourceName", sourceName); Objects.checkNull("objectIdType", objectIdType); return new AccessReporterImpl<T>(sourceName); }