@Override protected void setMemoryThresholdFlag(MemoryEvent event) { Assert.assertTrue(false); // Bucket regions are not registered with ResourceListener, // and should not get this event }
protected static String getJdkToolPathname(final Stack<String> pathnames, final GemFireException throwable) { assertNotNull(pathnames, "The JDK tool executable pathnames cannot be null!"); assertNotNull(throwable, "The GemFireException cannot be null!"); try { // assume 'java.home' JVM System property refers to the JDK installation directory. note, // however, that the // 'java.home' JVM System property usually refers to the JRE used to launch this application return IOUtils.verifyPathnameExists(pathnames.pop()); } catch (EmptyStackException ignore) { throw throwable; } catch (FileNotFoundException ignore) { return getJdkToolPathname(pathnames, throwable); } }
private void browse(URI uri) throws IOException { assertState(Desktop.isDesktopSupported(), String.format(CliStrings.DESKTOP_APP_RUN_ERROR_MESSAGE, System.getProperty("os.name"))); Desktop.getDesktop().browse(uri); }
public DLockGrantor getGrantor() { Assert.assertHoldsLock(this.destroyLock, false); synchronized (this.lockGrantorIdLock) { return this.grantor; } }
@Test public void testAssertArgumentIsIllegal() { assertThatThrownBy(() -> { Assert.assertArgument(false, "The actual argument is %1$s!", "illegal"); }).isInstanceOf(IllegalArgumentException.class).hasMessage("The actual argument is illegal!"); }
/** * Returns true if locking has been suspended. * <p> * Caller must synchronize on suspendLock. * * Concurrency: protected by synchronization of {@link #suspendLock} * * @return true if locking has been suspended */ protected boolean isLockingSuspended() { if (DEBUG_SUSPEND_LOCK) { Assert.assertHoldsLock(this.suspendLock, true); } return this.lockingSuspendedBy != null; }
@Test public void testAssertArgumentIsLegal() { Assert.assertArgument(true, ""); }
/** * This method is meant to be overridden by DistributedRegion and PartitionedRegions to cleanup * CRITICAL state */ public void removeCriticalMember(DistributedMember member) { // should not be called for LocalRegion Assert.assertTrue(false); }
@Test public void testAssertStateIsInvalid() { assertThatThrownBy(() -> { Assert.assertState(false, "The actual state is %1$s!", "invalid"); }).isInstanceOf(IllegalStateException.class).hasMessage("The actual state is invalid!"); } }
protected static String getJdkToolPathname(final String jdkToolExecutableName, final GemFireException throwable) { assertNotNull(jdkToolExecutableName, "The JDK tool executable name cannot be null!"); assertNotNull(throwable, "The GemFireException cannot be null!"); Stack<String> pathnames = new Stack<>(); pathnames.push(jdkToolExecutableName); pathnames .push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "..", "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(System.getenv("JAVA_HOME"), "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(JAVA_HOME, "..", "bin", jdkToolExecutableName)); pathnames.push(IOUtils.appendToPath(JAVA_HOME, "bin", jdkToolExecutableName)); return getJdkToolPathname(pathnames, throwable); }
private void basicRemoveIndex(int index) { Assert.assertHoldsLock(this, true); // minimize volatile reads by copying ref to local var Profile[] oldProfiles = this.profiles; // volatile read Profile[] newProfiles = new Profile[oldProfiles.length - 1]; System.arraycopy(oldProfiles, 0, newProfiles, 0, index); System.arraycopy(oldProfiles, index + 1, newProfiles, index, newProfiles.length - index); this.profiles = newProfiles; // volatile write if (this.numActiveProfiles > 0) { this.numActiveProfiles--; } }
@Override protected boolean operateOnRegion(CacheEvent event, ClusterDistributionManager dm) throws EntryNotFoundException { Assert.assertTrue(false, "Region Destruction message implementation is in basicProcess, not this method"); return false; }
@Test public void testAssertStateIsValid() { Assert.assertState(true, ""); }
@Test public void testAssertNotNullWithNullObject() { assertThatThrownBy(() -> { Assert.assertNotNull(null, "This is an %1$s message!", "expected"); }).isInstanceOf(NullPointerException.class).hasMessage("This is an expected message!"); }
/** * Returns true if <code>someLockGrantor</code> equals the current {@link #lockGrantorId}. * * @return true if someLockGrantor equals the current lockGrantorId */ private boolean equalsLockGrantorId(LockGrantorId someLockGrantor) { Assert.assertHoldsLock(this.lockGrantorIdLock, true); if (someLockGrantor == null) { return this.lockGrantorId == null; } return someLockGrantor.equals(this.lockGrantorId); }
/** * Create one of these in the local case so that we have a snapshot of the state and can allow the * bucket to move out from under us. */ public NonLocalRegionEntry(InternalRegion br, Object key, Object value) { this.key = key; this.value = value; Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); }
/** * Gets a proxy to the DistributedSystemMXBean from the GemFire Manager's MBeanServer, or null if * unable to find the DistributedSystemMXBean. * </p> * * @return a proxy to the DistributedSystemMXBean from the GemFire Manager's MBeanServer, or null * if unable to find the DistributedSystemMXBean. */ public static DistributedSystemMXBean getDistributedSystemMXBean() throws IOException, MalformedObjectNameException { assertState(Gfsh.isCurrentInstanceConnectedAndReady(), "Gfsh must be connected in order to get proxy to a GemFire DistributedSystemMXBean."); return Gfsh.getCurrentInstance().getOperationInvoker().getDistributedSystemMXBean(); }
@Test public void testAssetNotNullWithNonNullObject() { Assert.assertNotNull(new Object(), ""); }
/** * Returns true if {@link #lockGrantorId} is the same as the specified LockGrantorId. Caller must * synchronize on {@link #lockGrantorIdLock}. * * @param someLockGrantorId the LockGrantorId to check */ private boolean checkLockGrantorId(LockGrantorId someLockGrantorId) { Assert.assertHoldsLock(this.lockGrantorIdLock, true); if (this.lockGrantorId == null) { return false; } return this.lockGrantorId.sameAs(someLockGrantorId); }
/** * sets the ID of the client that initiated this event */ public void setContext(ClientProxyMembershipID contx) { Assert.assertTrue(contx != null); this.context = contx; }