use of org.apache.geode.internal.Version in project geode by apache.
the class ClientInterestMessageImpl method getMessage.
public Message getMessage(CacheClientProxy proxy, boolean notify) throws IOException {
Version clientVersion = proxy.getVersion();
Message message = null;
if (clientVersion.compareTo(Version.GFE_57) >= 0) {
message = getGFEMessage();
} else {
throw new IOException("Unsupported client version for server-to-client message creation: " + clientVersion);
}
return message;
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ClientPingMessageImpl method getMessage.
public Message getMessage(CacheClientProxy proxy, boolean notify) throws IOException {
Version clientVersion = proxy.getVersion();
Message message = null;
if (clientVersion.compareTo(Version.GFE_6622) >= 0) {
message = getGFEMessage();
} else {
throw new IOException("Unsupported client version for server-to-client message creation: " + clientVersion);
}
return message;
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ServerConnection method setHandshake.
public void setHandshake(ClientHandShake handshake) {
this.handshake = handshake;
Version v = handshake.getVersion();
this.replyMsg.setVersion(v);
this.requestMsg.setVersion(v);
this.responseMsg.setVersion(v);
this.errorMsg.setVersion(v);
this.queryResponseMsg.setVersion(v);
this.chunkedResponseMsg.setVersion(v);
this.executeFunctionResponseMsg.setVersion(v);
this.registerInterestResponseMsg.setVersion(v);
this.keySetResponseMsg.setVersion(v);
}
use of org.apache.geode.internal.Version in project geode by apache.
the class GMSMembershipManager method processView.
/**
* Analyze a given view object, generate events as appropriate
*/
protected void processView(long newViewId, NetView newView) {
// Sanity check...
if (logger.isDebugEnabled()) {
StringBuilder msg = new StringBuilder(200);
msg.append("Membership: Processing view ");
msg.append(newView);
msg.append("} on ").append(address.toString());
logger.debug(msg);
if (!newView.contains(address)) {
logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_THE_MEMBER_WITH_ID_0_IS_NO_LONGER_IN_MY_OWN_VIEW_1, new Object[] { address, newView }));
}
}
// We perform the update under a global lock so that other
// incoming events will not be lost in terms of our global view.
latestViewWriteLock.lock();
try {
// first determine the version for multicast message serialization
Version version = Version.CURRENT;
for (final Entry<InternalDistributedMember, Long> internalDistributedMemberLongEntry : surpriseMembers.entrySet()) {
InternalDistributedMember mbr = internalDistributedMemberLongEntry.getKey();
Version itsVersion = mbr.getVersionObject();
if (itsVersion != null && version.compareTo(itsVersion) < 0) {
version = itsVersion;
}
}
for (InternalDistributedMember mbr : newView.getMembers()) {
Version itsVersion = mbr.getVersionObject();
if (itsVersion != null && itsVersion.compareTo(version) < 0) {
version = mbr.getVersionObject();
}
}
disableMulticastForRollingUpgrade = !version.equals(Version.CURRENT);
if (newViewId < latestViewId) {
// ignore this view since it is old news
return;
}
// Save previous view, for delta analysis
NetView priorView = latestView;
// update the view to reflect our changes, so that
// callbacks will see the new (updated) view.
latestViewId = newViewId;
latestView = new NetView(newView, newView.getViewId());
// look for additions
for (int i = 0; i < newView.getMembers().size(); i++) {
// additions
InternalDistributedMember m = newView.getMembers().get(i);
// Once a member has been seen via a view, remove them from the
// newborn set. Replace the netmember of the surpriseMember ID
// in case it was a partial ID and is being retained by DistributionManager
// or some other object
boolean wasSurprise = surpriseMembers.containsKey(m);
if (wasSurprise) {
for (Iterator<Map.Entry<InternalDistributedMember, Long>> iterator = surpriseMembers.entrySet().iterator(); iterator.hasNext(); ) {
Entry<InternalDistributedMember, Long> entry = iterator.next();
if (entry.getKey().equals(m)) {
entry.getKey().setNetMember(m.getNetMember());
iterator.remove();
break;
}
}
}
// if it's in a view, it's no longer suspect
suspectedMembers.remove(m);
if (priorView.contains(m) || wasSurprise) {
// already seen
continue;
}
// unblock any waiters for this particular member.
// i.e. signal any waiting threads in tcpconduit.
String authInit = this.services.getConfig().getDistributionConfig().getSecurityPeerAuthInit();
boolean isSecure = authInit != null && authInit.length() != 0;
if (isSecure) {
CountDownLatch currentLatch;
if ((currentLatch = memberLatch.get(m)) != null) {
currentLatch.countDown();
}
}
if (shutdownInProgress()) {
addShunnedMember(m);
// no additions processed after shutdown begins
continue;
} else {
// bug #45158 - no longer shun a process that is now in
boolean wasShunned = endShun(m);
// view
if (wasShunned && logger.isDebugEnabled()) {
logger.debug("No longer shunning {} as it is in the current membership view", m);
}
}
logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_MEMBERSHIP_PROCESSING_ADDITION__0_, m));
try {
listener.newMemberConnected(m);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// now, so don't let this thread continue.
throw err;
} catch (DistributedSystemDisconnectedException e) {
// don't log shutdown exceptions
} 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();
logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_ADDITION_OF__0, m), t);
}
}
// look for departures
for (int i = 0; i < priorView.getMembers().size(); i++) {
// departures
InternalDistributedMember m = priorView.getMembers().get(i);
if (newView.contains(m)) {
// still alive
continue;
}
if (surpriseMembers.containsKey(m)) {
// member has not yet appeared in a view
continue;
}
try {
removeWithViewLock(m, newView.getCrashedMembers().contains(m) || suspectedMembers.containsKey(m), "departed membership view");
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// 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();
logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_MEMBERSHIP_FAULT_WHILE_PROCESSING_VIEW_REMOVAL_OF__0, m), t);
}
}
// departures
// expire surprise members, add others to view
long oldestAllowed = System.currentTimeMillis() - this.surpriseMemberTimeout;
for (Iterator<Map.Entry<InternalDistributedMember, Long>> it = surpriseMembers.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<InternalDistributedMember, Long> entry = it.next();
Long birthtime = entry.getValue();
if (birthtime.longValue() < oldestAllowed) {
it.remove();
InternalDistributedMember m = entry.getKey();
logger.info(LocalizedMessage.create(LocalizedStrings.GroupMembershipService_MEMBERSHIP_EXPIRING_MEMBERSHIP_OF_SURPRISE_MEMBER_0, m));
removeWithViewLock(m, true, "not seen in membership view in " + this.surpriseMemberTimeout + "ms");
} else {
if (!latestView.contains(entry.getKey())) {
latestView.add(entry.getKey());
}
}
}
// expire suspected members
/*
* the timeout interval for suspected members
*/
final long suspectMemberTimeout = 180000;
oldestAllowed = System.currentTimeMillis() - suspectMemberTimeout;
for (Iterator it = suspectedMembers.entrySet().iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry) it.next();
Long birthtime = (Long) entry.getValue();
if (birthtime.longValue() < oldestAllowed) {
it.remove();
}
}
try {
listener.viewInstalled(latestView);
} catch (DistributedSystemDisconnectedException se) {
}
} finally {
latestViewWriteLock.unlock();
}
}
use of org.apache.geode.internal.Version in project geode by apache.
the class RemotePutAllMessage method fromData.
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
this.posDup = (flags & POS_DUP) != 0;
if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
this.bridgeContext = DataSerializer.readObject(in);
}
this.skipCallbacks = (flags & SKIP_CALLBACKS) != 0;
this.putAllDataCount = (int) InternalDataSerializer.readUnsignedVL(in);
this.putAllData = new PutAllEntryData[putAllDataCount];
if (this.putAllDataCount > 0) {
final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
for (int i = 0; i < this.putAllDataCount; i++) {
this.putAllData[i] = new PutAllEntryData(in, this.eventId, i, version, bytesIn);
}
boolean hasTags = in.readBoolean();
if (hasTags) {
EntryVersionsList versionTags = EntryVersionsList.create(in);
for (int i = 0; i < this.putAllDataCount; i++) {
this.putAllData[i].versionTag = versionTags.get(i);
}
}
}
}
Aggregations