Java 类com.hazelcast.core.Client 实例源码

项目:bagri    文件:NodeInfoProvider.java   
@Override
public CompositeData call() throws Exception {
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    if (type == InfoType.memory) {
        ObjectName memName = new ObjectName("java.lang:type=Memory");
        return (CompositeData) mbs.getAttribute(memName, "HeapMemoryUsage");
    } else if (type == InfoType.timing) {
        ObjectName osName = new ObjectName("java.lang:type=Runtime");
        Map<String, Object> times = new HashMap<String, Object>(2);
        long time = (Long) mbs.getAttribute(osName, "StartTime");
        times.put("StartTime",  new Date(time).toString());
        time = (Long) mbs.getAttribute(osName, "Uptime");
        times.put("Uptime", DateUtils.getDuration(time));
        return JMXUtils.mapToComposite("Timings", "Timing info", times);
    } else {
        Set<HazelcastInstance> instances = Hazelcast.getAllHazelcastInstances();
        Map<String, Object> clients = new HashMap<String, Object>();
        for (HazelcastInstance hzInstance: instances) {
            for (Client client: hzInstance.getClientService().getConnectedClients()) {
                clients.put(client.getUuid(), client.getSocketAddress().toString());
            }
        }
        return JMXUtils.mapToComposite("Clients", "Clients info", clients);
    }
}
项目:bagri    文件:ClientManagementImpl.java   
@Override
public void clientDisconnected(Client client) {
    String clientId = client.getUuid();
    logger.trace("clientDisconnected.enter; client: {}", clientId);
    // check and destroy client's resources
    for (Map.Entry<String, Properties> entry: clientsCache.entrySet()) {
        Properties props = entry.getValue();
        String uuid = props.getProperty(pn_client_memberId);
        if (clientId.equals(uuid)) {
            clientsCache.remove(entry.getKey());
        }
    }
    //XQProcessor proc = processors.remove(client.getUuid());
}
项目:hazelcast-archive    文件:ClientServiceImpl.java   
private void doFireClientEvent(final Client client, final boolean connected) {
    if (client == null) throw new IllegalArgumentException("Client is null.");
    for (final ClientListener clientListener : listeners) {
        concurrentMapManager.node.executorManager.executeNow(new Runnable() {
            public void run() {
                if (connected) {
                    clientListener.clientConnected(client);
                } else {
                    clientListener.clientDisconnected(client);
                }
            }
        });
    }
}
项目:health-and-care-developer-network    文件:ClientServiceImpl.java   
private void doFireClientEvent(final Client client, final boolean connected) {
    if (client == null) throw new IllegalArgumentException("Client is null.");
    for (final ClientListener clientListener : listeners) {
        concurrentMapManager.node.executorManager.executeNow(new Runnable() {
            public void run() {
                if (connected) {
                    clientListener.clientConnected(client);
                } else {
                    clientListener.clientDisconnected(client);
                }
            }
        });
    }
}
项目:bagri    文件:ClientManagementImpl.java   
@Override
public void clientConnected(Client client) {
    String clientId = client.getUuid();
    logger.info("clientConnected.enter; client: {}", clientId); 
}
项目:hazelcast-archive    文件:ClientServiceImpl.java   
public Collection<Client> getConnectedClients() {
    return clients;
}
项目:hazelcast-archive    文件:ClientServiceImpl.java   
void add(Client client) {
    this.clients.add(client);
    doFireClientEvent(client, true);
}
项目:hazelcast-archive    文件:ClientServiceImpl.java   
void remove(Client client) {
    this.clients.remove(client);
    doFireClientEvent(client, false);
}
项目:health-and-care-developer-network    文件:ClientServiceImpl.java   
public Collection<Client> getConnectedClients() {
    return clients;
}
项目:health-and-care-developer-network    文件:ClientServiceImpl.java   
void add(Client client) {
    this.clients.add(client);
    doFireClientEvent(client, true);
}
项目:health-and-care-developer-network    文件:ClientServiceImpl.java   
void remove(Client client) {
    this.clients.remove(client);
    doFireClientEvent(client, false);
}