public String[] getGroups() { List<String> groups = cache.getDistributedSystem().getDistributedMember().getGroups(); String[] groupsArray = new String[groups.size()]; groupsArray = groups.toArray(groupsArray); return groupsArray; }
@Override public Object call() { InternalCache cache = GemFireCacheImpl.getInstance(); return cache.getDistributedSystem().getDistributedMember(); } };
private void sendCredentialsForWan(OutputStream out, InputStream in) { try { Properties wanCredentials = getCredentials(this.id.getDistributedMember()); DataOutputStream dos = new DataOutputStream(out); DataInputStream dis = new DataInputStream(in); writeCredentials(dos, dis, wanCredentials, false, this.system.getDistributedMember()); } // The exception while getting the credentials is just logged as severe catch (Exception e) { this.system.getSecurityLogWriter().severe( String.format("An exception was thrown while sending wan credentials: %s", e.getLocalizedMessage())); } }
@Override public void setTarget(DistributedMember target) { assert this.target == null; getRealDeal(target); if (this.target == null && isRealDealLocal()) { assert target.equals(getCache().getDistributedSystem().getDistributedMember()); this.target = target; } }
public DistributedMember getOwnerForKey(InternalRegion r, KeyInfo key) { DistributedMember m = r.getOwnerForKey(key); if (m == null) { m = getCache().getDistributedSystem().getDistributedMember(); } return m; } }
@Before public void setUp() { cache = mock(InternalCache.class); region = mock(LocalRegion.class); txId = new TXId(mock(InternalDistributedMember.class), 1); txManager = mock(TXManagerImpl.class); view = mock(LocalRegionDataView.class); system = mock(InternalDistributedSystem.class); member = mock(InternalDistributedMember.class); when(cache.getDistributedSystem()).thenReturn(system); when(system.getDistributedMember()).thenReturn(member); }
@Override public void precommit() { boolean retVal = applyOpsOnRedundantCopy(this.proxy.getCache().getDistributedSystem().getDistributedMember(), this.secondaryTransactionalOperations); if (retVal) { super.precommit(); } this.preCommitResponse = retVal; // Apply if no exception }
protected String getMemberId(final VM vm) { return vm.invoke("getMemberId", () -> { InternalCache cache = GemFireCacheImpl.getInstance(); return cache.getDistributedSystem().getDistributedMember().getId(); }); }
public MemberMXBean getMemberMxBean(DistributedMember targetMember) { SystemManagementService service = getManagementService(); if (getCache().getDistributedSystem().getDistributedMember().equals(targetMember)) { return service.getMemberMXBean(); } else { ObjectName objectName = service.getMemberMBeanName(targetMember); return service.getMBeanProxy(objectName, MemberMXBean.class); } } }
private void executeAlwaysException(FunctionContext context) { DistributedSystem ds = InternalDistributedSystem.getAnyInstance(); LogWriter logger = ds.getLogWriter(); logger.fine("Executing executeException in TestFunction on Member : " + ds.getDistributedMember() + "with Context : " + context); logger.fine("MyFunctionExecutionException Exception is intentionally thrown"); throw new MyFunctionExecutionException("I have been thrown from TestFunction"); }
public boolean areSecondariesPingable() { Set<InternalDistributedMember> hostingservers = this.partitionedRegion.getRegionAdvisor().getBucketOwners(this.getId()); hostingservers.remove(cache.getDistributedSystem().getDistributedMember()); if (cache.getLogger().fineEnabled()) cache.getLogger() .fine("Pinging secondaries of bucket " + this.getId() + " on servers " + hostingservers); if (hostingservers.size() == 0) return true; return ServerPingMessage.send(cache, hostingservers); }
private void createGatewayReceiverMBean(GatewayReceiver recv) { GatewayReceiverMBeanBridge bridge = new GatewayReceiverMBeanBridge(recv); GatewayReceiverMXBean receiverMBean = new GatewayReceiverMBean(bridge); ObjectName recvObjectName = MBeanJMXAdapter .getGatewayReceiverMBeanName(internalCache.getDistributedSystem().getDistributedMember()); ObjectName changedMBeanName = service.registerInternalMBean(receiverMBean, recvObjectName); service.federate(changedMBeanName, GatewayReceiverMXBean.class, true); Notification notification = new Notification(JMXNotificationType.GATEWAY_RECEIVER_CREATED, memberSource, SequenceNumber.next(), System.currentTimeMillis(), ManagementConstants.GATEWAY_RECEIVER_CREATED_PREFIX); memberLevelNotifEmitter.sendNotification(notification); }
@Override public void execute(FunctionContext context) { final Cache cache = context.getCache(); final String memberNameOrId = CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember()); String[] args = (String[]) context.getArguments(); String durableClientId = args[0]; String cqName = args[1]; context.getResultSender() .lastResult(createFunctionResult(memberNameOrId, durableClientId, cqName)); }
@Override public void execute(FunctionContext context) { final Cache cache = context.getCache(); final String memberNameOrId = CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember()); String args[] = (String[]) context.getArguments(); String durableClientId = args[0]; String cqName = args[1]; context.getResultSender() .lastResult(createFunctionResult(memberNameOrId, durableClientId, cqName)); }
@Override public void execute(final FunctionContext context) { final Cache cache = context.getCache(); final DistributedMember member = cache.getDistributedSystem().getDistributedMember(); String memberNameOrId = CliUtil.getMemberNameOrId(member); String durableClientId = (String) context.getArguments(); context.getResultSender().lastResult(createFunctionResult(memberNameOrId, durableClientId)); }
@Override public void execute(FunctionContext context) { String durableClientId = (String) context.getArguments(); final Cache cache = context.getCache(); final String memberNameOrId = CliUtil.getMemberNameOrId(cache.getDistributedSystem().getDistributedMember()); context.getResultSender().lastResult(createFunctionResult(memberNameOrId, durableClientId)); }
@Override public void execute(FunctionContext context) { InternalLocator locator = InternalLocator.getLocator(); InternalCache cache = (InternalCache) context.getCache(); DistributedMember member = cache.getDistributedSystem().getDistributedMember(); SharedConfigurationStatus status = locator.getSharedConfigurationStatus().getStatus(); String memberId = member.getName(); if (StringUtils.isBlank(memberId)) { memberId = member.getId(); } CliFunctionResult result = new CliFunctionResult(memberId, status.name(), null); context.getResultSender().lastResult(result); }
private void execute5(FunctionContext context) { DistributedSystem ds = InternalDistributedSystem.getAnyInstance(); LogWriter logger = ds.getLogWriter(); logger.info("Executing executeException in TestFunction on Member : " + ds.getDistributedMember() + "with Context : " + context); if (this.hasResult()) { if (context.getArguments() instanceof String) { context.getResultSender().lastResult("Success"); } else { context.getResultSender().lastResult("Failure"); } } }
@Test public void constructCqServerNameShouldReturnSameResultRegardlessOfOptimizedCacheNames() { CqServiceImpl cqService = new CqServiceImpl(Fakes.cache()); ClientProxyMembershipID proxyMembershipID = new ClientProxyMembershipID(Fakes.cache().getDistributedSystem().getDistributedMember()); String name1 = cqService.constructServerCqName("myCq", proxyMembershipID); String name2 = cqService.constructServerCqName("myCq", proxyMembershipID); assertEquals(name1, name2); }
@Test public void constructCqServerNameShouldReturnCorrectResultsEvenAfterCqClosingRemovesValuesFromOptimizedCache() throws Exception { CqServiceImpl cqService = new CqServiceImpl(Fakes.cache()); ClientProxyMembershipID proxyMembershipID = new ClientProxyMembershipID(Fakes.cache().getDistributedSystem().getDistributedMember()); String name1 = cqService.constructServerCqName("myCq", proxyMembershipID); cqService.closeCq("myCq", proxyMembershipID); String name2 = cqService.constructServerCqName("myCq", proxyMembershipID); assertEquals(name1, name2); }