use of org.neo4j.com.SlaveContext in project graphdb by neo4j-attic.
the class MasterImpl method getOngoingTransactions.
// =====================================================================
// Just some methods which aren't really used when running a HA cluster,
// but exposed so that other tools can reach that information.
// =====================================================================
public Map<Integer, Collection<SlaveContext>> getOngoingTransactions() {
Map<Integer, Collection<SlaveContext>> result = new HashMap<Integer, Collection<SlaveContext>>();
for (SlaveContext context : transactions.keySet()) {
Collection<SlaveContext> txs = result.get(context.machineId());
if (txs == null) {
txs = new ArrayList<SlaveContext>();
result.put(context.machineId(), txs);
}
txs.add(context);
}
return result;
}
use of org.neo4j.com.SlaveContext in project graphdb by neo4j-attic.
the class MasterServer method getSlaveInformation.
public Map<Integer, Collection<SlaveContext>> getSlaveInformation() {
// Which slaves are connected a.t.m?
Set<Integer> machineIds = new HashSet<Integer>();
Map<Channel, SlaveContext> channels = getConnectedSlaveChannels();
synchronized (channels) {
for (SlaveContext context : channels.values()) {
machineIds.add(context.machineId());
}
}
// Insert missing slaves into the map so that all connected slave
// are in the returned map
Map<Integer, Collection<SlaveContext>> ongoingTransactions = ((MasterImpl) getMaster()).getOngoingTransactions();
for (Integer machineId : machineIds) {
if (!ongoingTransactions.containsKey(machineId)) {
ongoingTransactions.put(machineId, Collections.<SlaveContext>emptyList());
}
}
return new TreeMap<Integer, Collection<SlaveContext>>(ongoingTransactions);
}
Aggregations