本文整理汇总了Java中org.apache.geode.distributed.DistributedMember类的典型用法代码示例。如果您正苦于以下问题:Java DistributedMember类的具体用法?Java DistributedMember怎么用?Java DistributedMember使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DistributedMember类属于org.apache.geode.distributed包,在下文中一共展示了DistributedMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doAfterRegionCreated
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
private void doAfterRegionCreated(Region region, boolean distributed, boolean isOriginRemote,
DistributedMember mbr) {
RegionEvent event =
new RegionEventImpl(region, Operation.REGION_CREATE, null, isOriginRemote, getMember(mbr));
for (Iterator i = regionListeners.iterator(); i.hasNext();) {
DynamicRegionListener listener = (DynamicRegionListener) i.next();
try {
listener.afterRegionCreate(event /* region */ );
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// If this ever returns, rethrow the error. We're poisoned
// now, so don't let this thread continue.
throw err;
} catch (Throwable t) {
// Whenever you catch Error or Throwable, you must also
// catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
this.c.getLoggerI18n().warning(
LocalizedStrings.DynamicRegionFactory_DYNAMICREGIONLISTENER__0__THREW_EXCEPTION_ON_AFTERREGIONCREATED,
listener, t);
}
}
}
示例2: executeFunction
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* Execute the provided named function in all locations that contain the given keys. So function
* can be executed on just one fabric node, executed in parallel on a subset of nodes in parallel
* across all the nodes.
*
* @since GemFire 5.8Beta
*/
public ResultCollector executeFunction(final DistributedRegionFunctionExecutor execution,
final Function function, final Object args, final ResultCollector rc, final Set filter,
final ServerToClientFunctionResultSender sender) {
if (function.optimizeForWrite() && memoryThresholdReached.get()
&& !MemoryThresholds.isLowMemoryExceptionDisabled()) {
Set<DistributedMember> htrm = getMemoryThresholdReachedMembers();
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_FOR_0_FUNCEXEC_MEMBERS_1
.toLocalizedString(new Object[] {function.getId(), htrm}),
htrm);
}
final LocalResultCollector<?, ?> localRC = execution.getLocalResultCollector(function, rc);
final DM dm = getDistributionManager();
execution.setExecutionNodes(Collections.singleton(getMyId()));
final DistributedRegionFunctionResultSender resultSender =
new DistributedRegionFunctionResultSender(dm, localRC, function, sender);
final RegionFunctionContextImpl context = new RegionFunctionContextImpl(function.getId(),
LocalRegion.this, args, filter, null, null, resultSender, execution.isReExecute(),
AmpoolTableRegionAttributes.getRegionDataOrder(this.getCustomAttributes()), 0);
execution.executeFunctionOnLocalNode(function, context, resultSender, dm, isTX());
return localRC;
}
示例3: send
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
public static RemoveAllResponse send(DistributedMember recipient, EntryEventImpl event,
RemoveAllEntryData[] removeAllData, int removeAllDataCount, boolean useOriginRemote,
int processorType, boolean possibleDuplicate) throws RemoteOperationException {
// Assert.assertTrue(recipient != null, "RemoteRemoveAllMessage NULL recipient"); recipient can
// be null for event notifications
Set recipients = Collections.singleton(recipient);
RemoveAllResponse p = new RemoveAllResponse(event.getRegion().getSystem(), recipients);
RemoteRemoveAllMessage msg = new RemoteRemoveAllMessage(event, recipients, p, removeAllData,
removeAllDataCount, useOriginRemote, processorType, possibleDuplicate);
msg.setTransactionDistributed(event.getRegion().getCache().getTxManager().isDistributed());
Set failures = event.getRegion().getDistributionManager().putOutgoing(msg);
if (failures != null && failures.size() > 0) {
throw new RemoteOperationException(
LocalizedStrings.RemotePutMessage_FAILED_SENDING_0.toLocalizedString(msg));
}
return p;
}
示例4: getMembersByIds
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
private Set<DistributedMember> getMembersByIds(Cache cache, Set<String> memberIds) {
Set<DistributedMember> foundMembers = Collections.emptySet();
if (memberIds != null && !memberIds.isEmpty()) {
foundMembers = new HashSet<DistributedMember>();
Set<DistributedMember> allNormalMembers = CliUtil.getAllNormalMembers(cache);
for (String memberId : memberIds) {
for (DistributedMember distributedMember : allNormalMembers) {
if (memberId.equals(distributedMember.getId())
|| memberId.equals(distributedMember.getName())) {
foundMembers.add(distributedMember);
}
}
}
}
return foundMembers;
}
示例5: waitForMemberDeparture
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* wait for a member to leave the view. Throws an assertionerror if the timeout period elapses
* before the member leaves
*/
public static void waitForMemberDeparture(final DistributedSystem sys,
final DistributedMember member, final long timeout) {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return !getMembershipManager(sys).getView().contains((InternalDistributedMember) member);
}
public String description() {
String assMsg =
"Waited over " + timeout + " ms for " + member + " to depart, but it didn't";
return assMsg;
}
};
Wait.waitForCriterion(ev, timeout, 200, true);
}
示例6: checkIfAboveThreshold
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* Checks to see if the event should be rejected because of sick state either due to exceeding
* local critical threshold or a remote member exceeding critical threshold
*
* @param key the key for the operation
* @throws LowMemoryException if the target member for this operation is sick
*/
private void checkIfAboveThreshold(final Object key) throws LowMemoryException {
if (memoryThresholdReached.get()) {
Set<DistributedMember> htrm = getMemoryThresholdReachedMembers();
// #45603: trigger a background eviction since we're above the the critical
// threshold
InternalResourceManager.getInternalResourceManager(cache).getHeapMonitor()
.updateStateAndSendEvent();
Object[] prms = new Object[] {getFullPath(), key, htrm};
throw new LowMemoryException(
LocalizedStrings.ResourceManager_LOW_MEMORY_IN_0_FOR_PUT_1_MEMBER_2
.toLocalizedString(prms),
htrm);
}
}
示例7: validateGroups
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
private void validateGroups(Cache cache, String[] groups) {
if (groups != null && groups.length != 0) {
Set<String> existingGroups = new HashSet<String>();
Set<DistributedMember> members = CliUtil.getAllNormalMembers(cache);
for (DistributedMember distributedMember : members) {
List<String> memberGroups = distributedMember.getGroups();
existingGroups.addAll(memberGroups);
}
List<String> groupsList = new ArrayList<String>(Arrays.asList(groups));
groupsList.removeAll(existingGroups);
if (!groupsList.isEmpty()) {
throw new IllegalArgumentException(
CliStrings.format(CliStrings.CREATE_REGION__MSG__GROUPS_0_ARE_INVALID,
new Object[] {String.valueOf(groupsList)}));
}
}
}
示例8: onMembers
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* Returns an {@link Execution} object that can be used to execute a data independent function on
* all members of the {@link DistributedSystem}. If one of the members goes down while dispatching
* or executing the function on the member, an Exception will be thrown.
*
* @param system defines the distributed system
* @return Execution
*
* @throws FunctionException if DistributedSystem instance passed is null
* @since GemFire 6.0
*/
public final Execution onMembers(DistributedSystem system, String... groups) {
if (system == null) {
throw new FunctionException(LocalizedStrings.FunctionService_0_PASSED_IS_NULL
.toLocalizedString("DistributedSystem instance "));
}
if (groups.length == 0) {
return new MemberFunctionExecutor(system);
}
Set<DistributedMember> members = new HashSet<DistributedMember>();
for (String group : groups) {
members.addAll(system.getGroupMembers(group));
}
if (members.isEmpty()) {
throw new FunctionException(LocalizedStrings.FunctionService_NO_MEMBERS_FOUND_IN_GROUPS
.toLocalizedString(Arrays.toString(groups)));
}
return new MemberFunctionExecutor(system, members);
}
示例9: testClientHealthStats_SubscriptionDisabled
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
@Test
public void testClientHealthStats_SubscriptionDisabled() throws Exception {
helper.createManagementCache(managingNode);
helper.startManagingNode(managingNode);
int port = (Integer) server.invoke(() -> ClientHealthStatsDUnitTest.createServerCache());
DistributedMember serverMember = helper.getMember(server);
client.invoke(() -> ClientHealthStatsDUnitTest.createClientCache(server.getHost(), port, 1,
false, false));
client2.invoke(() -> ClientHealthStatsDUnitTest.createClientCache(server.getHost(), port, 2,
false, false));
client.invoke(() -> ClientHealthStatsDUnitTest.put());
client2.invoke(() -> ClientHealthStatsDUnitTest.put());
managingNode.invoke(() -> ClientHealthStatsDUnitTest.verifyClientStats(serverMember, port, 0));
helper.stopManagingNode(managingNode);
}
示例10: prHostsBucketForKey
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
private boolean prHostsBucketForKey(VM vm, final Object key) {
Boolean result = (Boolean) vm.invoke(new SerializableCallable("prHostsBucketForKey") {
public Object call() {
Cache cache = getCache();
DistributedMember myId = cache.getDistributedSystem().getDistributedMember();
Region region = cache.getRegion("region");
DistributedMember hostMember = PartitionRegionHelper.getPrimaryMemberForKey(region, key);
if (hostMember == null) {
throw new IllegalStateException("bucket for key " + key + " is not hosted!");
}
boolean res = Boolean.valueOf(myId.equals(hostMember));
// cache.getLogger().info("DEBUG prHostsBucketForKey=" + res);
return res;
}
});
return result.booleanValue();
}
示例11: invalidateCachedPrivileges
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
@CliCommand(value = MashCliStrings.INVALIDATE_PRIVILEGE_CACHE,
help = MashCliStrings.INVALIDATE_PRIVILEGE_CACHE__HELP)
@CliMetaData(relatedTopic = {MashCliStrings.TOPIC_AMPOOL_AUTHZ})
public Result invalidateCachedPrivileges() {
/* Invalidate the cache on locator */
SecurityManager securityManager = SecurityService.getSecurityService().getSecurityManager();
try {
securityManager.invalidateAuthzCache();
} catch (Exception e) {
return ResultBuilder.createMTableErrorResult(e.getClass().toString());
}
Set<DistributedMember> targetMembers;
/* Execute a function on all servers to invalidate the cache */
try {
targetMembers = CliUtil.findOneMatchingMember(null, null);
} catch (CommandResultException ex) {
logger.error("Error while finding members. Error: " + ex.getResult().nextLine());
return ex.getResult();
}
ResultCollector<?, ?> rc =
CliUtil.executeFunction(new InvalidateAuthzCacheFunction(), null, targetMembers);
List results = (ArrayList) rc.getResult();
for (Object result : results) {
if (result instanceof Exception) {
return ResultBuilder.createMTableErrorResult(
MashCliStrings.INVALIDATE_PRIVILEGE_CACHE__ERROR + ((Exception) result).getMessage());
}
}
return ResultBuilder.createInfoResult(MashCliStrings.INVALIDATE_PRIVILEGE_CACHE__SUCCESS);
}
示例12: send
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* Sends an InvalidateMessage {@link org.apache.geode.cache.Region#invalidate(Object)}message to
* the recipient
*
* @param recipient the recipient of the message
* @param r the PartitionedRegion for which the invalidate was performed
* @param event the event causing this message
* @return the InvalidateResponse processor used to await the potential
* {@link org.apache.geode.cache.CacheException}
* @throws ForceReattemptException if the peer is no longer available
*/
public static InvalidateResponse send(DistributedMember recipient, PartitionedRegion r,
EntryEventImpl event) throws ForceReattemptException {
// Assert.assertTrue(recipient != null, "InvalidateMessage NULL recipient"); recipient may be
// null for remote notifications
Set recipients = Collections.singleton(recipient);
InvalidateResponse p = new InvalidateResponse(r.getSystem(), recipients, event.getKey());
InvalidateMessage m = new InvalidateMessage(recipients, false, r.getPRId(), p, event);
Set failures = r.getDistributionManager().putOutgoing(m);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException(
LocalizedStrings.InvalidateMessage_FAILED_SENDING_0.toLocalizedString(m));
}
return p;
}
示例13: referenceEndpoint
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
public Endpoint referenceEndpoint(ServerLocation server, DistributedMember memberId) {
// logger.warn("REFENDPOINT server:"+server+" memberId:"+memberId);
Endpoint endpoint = endpointMap.get(server);
boolean addedEndpoint = false;
if (endpoint == null || endpoint.isClosed()) {
synchronized (this) {
endpoint = endpointMap.get(server);
if (endpoint == null || endpoint.isClosed()) {
ConnectionStats stats = getStats(server);
Map<ServerLocation, Endpoint> endpointMapTemp =
new HashMap<ServerLocation, Endpoint>(endpointMap);
endpoint = new Endpoint(this, ds, server, stats, memberId);
listener.clearPdxRegistry(endpoint);
endpointMapTemp.put(server, endpoint);
endpointMap = Collections.unmodifiableMap(endpointMapTemp);
addedEndpoint = true;
poolStats.setServerCount(endpointMap.size());
}
}
}
endpoint.addReference();
if (addedEndpoint) {
// logger.warn("EMANFIRE2:JOIN:"+endpoint.getLocation()+" mid:"+endpoint.getMemberId());
listener.endpointNowInUse(endpoint);
} else {
// logger.warn("EMANFIRE33:NOJOIN:"+endpoint.getLocation()+" mid:"+endpoint.getMemberId());
}
return endpoint;
}
示例14: waitForThreadOwnedOrderedConnectionState
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* wait for the incoming connections identified by the keys in the argument to receive and
* dispatch the number of messages associated with the key
*
* @since GemFire 5.1
*/
public void waitForThreadOwnedOrderedConnectionState(DistributedMember member, Map channelState)
throws InterruptedException {
// if (Thread.interrupted()) throw new InterruptedException(); not necessary done in
// waitForThreadOwnedOrderedConnectionState
getConTable().waitForThreadOwnedOrderedConnectionState(member, channelState);
}
示例15: create
import org.apache.geode.distributed.DistributedMember; //导入依赖的package包/类
/**
* Creates and returns an EntryEventImpl. Generates and assigns a bucket id to the EntryEventImpl
* if the region parameter is a PartitionedRegion.
*
* Called by BridgeEntryEventImpl to use existing EventID
*
* {@link EntryEventImpl#EntryEventImpl(LocalRegion, Operation, Object, Object, Object, boolean, DistributedMember, boolean, EventID)}
*/
@Retained
public static EntryEventImpl create(LocalRegion region, Operation op, Object key,
@Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
EventID eventID) {
EntryEventImpl entryEvent = new EntryEventImpl(region, op, key, newValue, callbackArgument,
originRemote, distributedMember, generateCallbacks, eventID);
return entryEvent;
}