use of com.ms.silverking.id.UUIDBase in project SilverKing by Morgan-Stanley.
the class ActiveVersionedBasicOperations method receivedOpResponse.
public void receivedOpResponse(MessageGroup message) {
AsyncVersionedBasicOperationImpl op;
UUIDBase uuid;
byte resultCode;
long uuidMSL;
long uuidLSL;
uuidMSL = message.getBuffers()[0].getLong(0);
uuidLSL = message.getBuffers()[0].getLong(NumConversion.BYTES_PER_LONG);
resultCode = message.getBuffers()[0].get(2 * NumConversion.BYTES_PER_LONG);
uuid = new UUIDBase(uuidMSL, uuidLSL);
op = getOp(uuid);
if (op != null) {
OpResult result;
result = EnumValues.opResult[resultCode];
op.setResult(result);
} else {
Log.warning("No operation for response: ", uuid);
}
}
use of com.ms.silverking.id.UUIDBase in project SilverKing by Morgan-Stanley.
the class Connection method sendFailed.
// ////////////////////////////////////////////////////////////////////
/**
* Must be called if a send fails.
*/
protected void sendFailed(OutgoingData data) {
ActiveSend activeSend;
UUIDBase sendUUID;
if (verbose) {
Log.warning("sendFailed", remoteSocketAddress);
data.displayForDebug();
}
sendUUID = data.getSendUUID();
if (sendUUID != null && activeBlockingSends != null) {
activeSend = activeBlockingSends.get(sendUUID);
} else {
activeSend = null;
}
if (activeSend != null) {
activeSend.setException(new IOException("send failed"));
} else {
if (Log.levelMet(Level.FINE)) {
Log.fine("sendFailed() not an active send ", data.getSendUUID() + " " + remoteSocketAddress);
}
}
data.failed();
}
use of com.ms.silverking.id.UUIDBase in project SilverKing by Morgan-Stanley.
the class Connection method sendSucceeded.
/**
* Must be called if a send succeeds.
* @param data
*/
protected void sendSucceeded(OutgoingData data) {
ActiveSend activeSend;
UUIDBase sendUUID;
if (AsyncGlobals.debug && debug) {
Log.fine("sendSucceeded", remoteSocketAddress);
}
sendUUID = data.getSendUUID();
if (sendUUID != null && activeBlockingSends != null) {
activeSend = activeBlockingSends.get(sendUUID);
} else {
activeSend = null;
}
if (activeSend != null) {
activeSend.setSentSuccessfully();
} else {
if (AsyncGlobals.debug && debug && Log.levelMet(Level.FINE)) {
Log.fine("sendSucceeded() not an active send ", data.getSendUUID() + " " + remoteSocketAddress);
}
}
data.successful();
}
use of com.ms.silverking.id.UUIDBase in project SilverKing by Morgan-Stanley.
the class DHTRingMaster method recoverData.
public UUIDBase recoverData() {
UUIDBase uuid;
Log.warningAsyncf("DHTRingMaster.recoverData");
uuid = UUIDBase.random();
recoverDataWorker.addWork(uuid);
return uuid;
}
use of com.ms.silverking.id.UUIDBase in project SilverKing by Morgan-Stanley.
the class DHTRingMaster method syncData.
public void syncData(Quadruple<UUIDBase, Quadruple<String, Long, Long, Long>, Quadruple<String, Long, Long, Long>, SyncTargets> idAndRings) {
UUIDBase uuid;
Quadruple<String, Long, Long, Long> sourceRing;
Quadruple<String, Long, Long, Long> targetRing;
uuid = idAndRings.getV1();
sourceRing = idAndRings.getV2();
targetRing = idAndRings.getV3();
Log.warningAsyncf("DHTRingMaster.syncData %s %s %s", uuid, sourceRing.getV1(), targetRing.getV1());
convergenceLock.lock();
try {
if (/*!isValidTarget(targetRing)*/
false) {
// FUTURE think about checking validity
// FUTURE - could improve this sanity check to look at zk info
Log.warningAsyncf("Ignoring invalid sync %s %s", sourceRing, targetRing);
} else {
if (enableLogging) {
Log.warningAsync("New ring: ", targetRing);
}
try {
ConvergencePoint _sourceCP;
ConvergencePoint _targetCP;
// Check for old convergence
if (targetConvergenceController != null) {
if (enableLogging) {
Log.warningAsync("Can't sync due to ongoing convergence: ", targetRing);
return;
}
}
// Start new sync
_sourceCP = new ConvergencePoint(dhtConfig.getVersion(), RingIDAndVersionPair.fromRingNameAndVersionPair(sourceRing.getTripleAt1()), sourceRing.getV4());
_targetCP = new ConvergencePoint(dhtConfig.getVersion(), RingIDAndVersionPair.fromRingNameAndVersionPair(targetRing.getTripleAt1()), targetRing.getV4());
try {
targetConvergenceController = new CentralConvergenceController(uuid, dhtMetaReader, _sourceCP, _targetCP, readExclusions(targetRing), mgBase, syncUnchangedOwners, CentralConvergenceController.RequestedSyncMode.SyncOnly);
convergenceControllers.put(targetConvergenceController.getUUID(), targetConvergenceController);
} catch (IOException ioe) {
Log.logErrorWarning(ioe, "Unable to start sync");
return;
}
try {
convergenceLock.unlock();
try {
if (enableLogging) {
Log.warningAsync("Calling converge(): ", targetRing);
}
((CentralConvergenceController) targetConvergenceController).converge(idAndRings.getV4());
} finally {
convergenceLock.lock();
}
targetConvergenceController = null;
if (enableLogging) {
Log.warningAsync("Convergence complete: ", targetRing);
}
} catch (ConvergenceException ce) {
// Convergence failed
if (!ce.getAbandoned()) {
// Failed due to an exception
Log.logErrorWarning(ce, "Convergence failed due to exception");
} else {
// Failed due to a new target causing the old convergence to be abandoned
// In this case, the new convergence will take over the cur and target pointers
Log.warningAsync("Previous convergence abandoned");
}
}
} catch (KeeperException ke) {
// Retries are internal to DHTringCurTargetZK. If we got here, those
// retries failed.
// FUTURE - relay to alerting
Log.logErrorWarning(ke, "Unexpected exception during peerStateMet handling");
}
}
} finally {
convergenceLock.unlock();
}
}
Aggregations