use of org.apache.geode.GemFireIOException in project geode by apache.
the class DistributionAdvisor method waitForCurrentOperations.
/**
* wait for the current operations being sent on views prior to the joining of the given member to
* be placed on communication channels before returning
*
* @since GemFire 5.1
*/
public void waitForCurrentOperations(long timeout) {
// CacheProfile profile = (CacheProfile)getProfile(member);
// long targetVersion = profile.initialMembershipVersion - 1;
// this may wait longer than it should if the membership version changes, dumping
// more operations into the previousVersionOpCount
long startTime = System.currentTimeMillis();
long warnTime = startTime + timeout;
long quitTime = warnTime + timeout - 1000L;
boolean warned = false;
final boolean isDebugEnabled_STATE_FLUSH_OP = logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP);
while (true) {
long opCount;
synchronized (this.opCountLock) {
opCount = this.previousVersionOpCount;
}
if (opCount <= 0) {
break;
}
// See bug 34361 comment 79
if (isDebugEnabled_STATE_FLUSH_OP) {
logger.trace(LogMarker.STATE_FLUSH_OP, "Waiting for current operations to finish({})", opCount);
}
try {
Thread.sleep(50);
} catch (InterruptedException e) {
throw new GemFireIOException("State flush interrupted");
}
long now = System.currentTimeMillis();
if ((!warned) && System.currentTimeMillis() >= warnTime) {
warned = true;
logger.warn(LocalizedMessage.create(LocalizedStrings.DistributionAdvisor_0_SEC_HAVE_ELAPSED_WHILE_WAITING_FOR_CURRENT_OPERATIONS_TO_DISTRIBUTE, Long.toString((warnTime - startTime) / 1000L)));
} else if (warned && (now >= quitTime)) {
// OSProcess.printStacks(0);
throw new GemFireIOException("Current operations did not distribute within " + (now - startTime) + " milliseconds");
}
}
if (this.membershipClosed) {
if (isDebugEnabled_STATE_FLUSH_OP) {
logger.trace(LogMarker.STATE_FLUSH_OP, "State Flush stopped waiting for operations to distribute because advisor has been closed");
}
}
}
use of org.apache.geode.GemFireIOException in project geode by apache.
the class InternalDistributedSystem method createAndStartCacheServers.
/**
* after an auto-reconnect we may need to recreate a cache server and start it
*/
public void createAndStartCacheServers(List<CacheServerCreation> cacheServerCreation, InternalCache cache) {
List<CacheServer> servers = cache.getCacheServers();
// to recreate it.
if (servers.isEmpty() && cacheServerCreation != null) {
for (CacheServerCreation bridge : cacheServerCreation) {
CacheServerImpl impl = (CacheServerImpl) cache.addCacheServer();
impl.configureFrom(bridge);
}
}
servers = cache.getCacheServers();
for (CacheServer server : servers) {
try {
if (!server.isRunning()) {
server.start();
}
} catch (IOException ex) {
throw new GemFireIOException(LocalizedStrings.CacheCreation_WHILE_STARTING_CACHE_SERVER_0.toLocalizedString(server), ex);
}
}
}
use of org.apache.geode.GemFireIOException in project geode by apache.
the class AgentConfigImpl method appendOptionalPropertyFileProperties.
/**
* Appends any additional property-file specified properties to the supplied Properties. If the
* supplied property overrides the property in the property-file, then property-file value is
* ignored. System Properties always override the supplied properties
*
* @return appendedProps Properties appened to from the property-file if any
*/
private static Properties appendOptionalPropertyFileProperties(final Properties props) {
final URL url = getPropertyFileURL(retrievePropertyFile());
final Properties appendedProps = new Properties();
appendedProps.putAll(props);
// first, get any property values set in the optional property file
if (url != null) {
InputStream in = null;
try {
in = url.openStream();
final Properties agentPropertyFileProperties = new Properties();
agentPropertyFileProperties.load(in);
// don't let any properties from the file override those on the command-line
for (final Object key : agentPropertyFileProperties.keySet()) {
if (props.getProperty(key.toString()) == null) {
appendedProps.setProperty(key.toString(), agentPropertyFileProperties.getProperty(key.toString()));
}
}
} catch (IOException e) {
throw new GemFireIOException(LocalizedStrings.AgentConfigImpl_FAILED_READING_0.toLocalizedString(url.toString()), e);
} finally {
IOUtils.close(in);
}
}
// TODO this is not exactly overriding!
for (final Object propSuffix : props.keySet()) {
final String key = SYSTEM_PROPERTY_PREFIX + propSuffix;
final String value = System.getProperty(key);
if (value != null) {
appendedProps.put(key, value);
}
}
return appendedProps;
}
use of org.apache.geode.GemFireIOException in project geode by apache.
the class InternalDistributedSystem method startInitLocator.
/**
* @since GemFire 5.7
*/
private void startInitLocator() throws InterruptedException {
String locatorString = this.originalConfig.getStartLocator();
if (locatorString.length() == 0) {
return;
}
// there is a quorum of the old members available
if (attemptingToReconnect && !this.isConnected) {
if (this.quorumChecker != null) {
logger.info("performing a quorum check to see if location services can be started early");
if (!quorumChecker.checkForQuorum(3 * this.config.getMemberTimeout())) {
logger.info("quorum check failed - not allowing location services to start early");
return;
}
logger.info("Quorum check passed - allowing location services to start early");
}
}
DistributionLocatorId locId = new DistributionLocatorId(locatorString);
try {
this.startedLocator = // LOG: this is
InternalLocator.createLocator(// LOG: this is
locId.getPort(), // LOG: this is
null, // LOG: this is
null, // LOG: this is
this.logWriter, // LOG: this is after IDS has created LogWriterLoggers and
this.securityLogWriter, // Appenders
locId.getHost(), locId.getHostnameForClients(), this.originalConfig.toProperties(), false);
// if locator is started this way, cluster config is not enabled, set the flag correctly
this.startedLocator.getConfig().setEnableClusterConfiguration(false);
boolean startedPeerLocation = false;
try {
this.startedLocator.startPeerLocation(true);
startedPeerLocation = true;
} finally {
if (!startedPeerLocation) {
this.startedLocator.stop();
}
}
} catch (IOException e) {
throw new GemFireIOException(LocalizedStrings.InternalDistributedSystem_PROBLEM_STARTING_A_LOCATOR_SERVICE.toLocalizedString(), e);
}
}
use of org.apache.geode.GemFireIOException in project geode by apache.
the class IntegratedSecurityService method postProcess.
public Object postProcess(Object principal, String regionPath, Object key, Object value, boolean valueIsSerialized) {
if (!needPostProcess())
return value;
if (principal == null) {
Subject subject = getSubject();
if (subject == null)
return value;
principal = (Serializable) subject.getPrincipal();
}
String regionName = StringUtils.stripStart(regionPath, "/");
Object newValue = null;
// it to the callback.
if (valueIsSerialized && value instanceof byte[]) {
try {
Object oldObj = EntryEventImpl.deserialize((byte[]) value);
Object newObj = postProcessor.processRegionValue(principal, regionName, key, oldObj);
newValue = BlobHelper.serializeToBlob(newObj);
} catch (IOException | SerializationException e) {
throw new GemFireIOException("Exception de/serializing entry value", e);
}
} else {
newValue = postProcessor.processRegionValue(principal, regionName, key, value);
}
return newValue;
}
Aggregations