List of usage examples for java.util.concurrent.atomic AtomicBoolean AtomicBoolean
public AtomicBoolean()
From source file:com.google.gerrit.server.documentation.MarkdownFormatter.java
private static String readCSS() { if (defaultCss != null) { return defaultCss; }//from ww w . j a v a 2 s.com try { return readPegdownCss(new AtomicBoolean()); } catch (IOException err) { log.warn("Cannot load pegdown.css", err); return ""; } }
From source file:io.nebo.container.HttpContentInputStream.java
public HttpContentInputStream() { this.closed = new AtomicBoolean(); queue = new LinkedBlockingQueue<>(); }
From source file:fr.xebia.servlet.filter.SecuredRemoteAddressFilterTest.java
private void testRemoteAddr(String remoteAddr, boolean expected) throws ServletException, IOException { SecuredRemoteAddressFilter filter = new SecuredRemoteAddressFilter(); MockFilterConfig filterConfig = new MockFilterConfig(); filter.init(filterConfig);//from w w w .j a va2 s .c o m final AtomicBoolean secured = new AtomicBoolean(); MockFilterChain filterChain = new MockFilterChain() { @Override public void doFilter(ServletRequest request, ServletResponse response) { secured.set(request.isSecure()); } }; MockHttpServletRequest request = new MockHttpServletRequest(); request.setRemoteAddr(remoteAddr); filter.doFilter(request, new MockHttpServletResponse(), filterChain); assertEquals(expected, secured.get()); }
From source file:ch.cyberduck.core.ssl.CertificateStoreX509KeyManagerTest.java
@Test public void testChooseClientAliasStartcom() throws Exception { final AtomicBoolean choose = new AtomicBoolean(); final X509KeyManager m = new CertificateStoreX509KeyManager(new DisabledCertificateStore() { @Override/* w w w. ja v a 2 s . co m*/ public X509Certificate choose(String[] keyTypes, Principal[] issuers, String hostname, String prompt) throws ConnectionCanceledException { assertEquals( "The server requires a certificate to validate your identity. Select the certificate to authenticate yourself to test.cyberduck.ch.", prompt); for (Principal issuer : issuers) { assertEquals("CN=StartCom Class 2 Primary Intermediate Client CA", issuer.getName()); } choose.set(true); throw new ConnectionCanceledException(); } }).init(); assertNull(m.chooseClientAlias(new String[] { "RSA", "DSA" }, new Principal[] { new X500Principal("CN=StartCom Class 2 Primary Intermediate Client CA") }, new Socket("test.cyberduck.ch", 443))); assertTrue(choose.get()); }
From source file:com.conwet.xjsp.session.SessionState.java
public SessionState(FeatureMap features) { this.features = features; this.session = null; // Lazy initialization this.closed = new AtomicBoolean(); }
From source file:oz.hadoop.yarn.api.core.DataProcessorImpl.java
/** * /*from ww w . ja v a 2 s . com*/ * @param containerDelegates */ DataProcessorImpl(ApplicationContainerServer clientServer) { this.clientServer = clientServer; this.containerDelegates = this.clientServer.getContainerDelegates(); this.busyDelegatesFlags = new AtomicBoolean[containerDelegates.length]; for (int i = 0; i < busyDelegatesFlags.length; i++) { this.busyDelegatesFlags[i] = new AtomicBoolean(); } this.completedSinceStart = new AtomicLong(); this.active = true; }
From source file:com.collaborne.jsonschema.generator.pojo.PojoGeneratorTest.java
@Test public void generateInternalPrimitiveTypeReturnsPrimitiveTypeWithoutGeneration() throws CodeGenerationException, IOException { JsonNode schemaNode = jsonNodeReader.fromReader(new StringReader("{\"type\": \"string\"}")); SchemaTree schema = schemaLoader.load(schemaNode); Mapping mapping = new Mapping(URI.create("http://example.com/type.json#"), ClassName.create(Integer.TYPE)); final AtomicBoolean writeSourceCalled = new AtomicBoolean(); PojoGenerator generator = new PojoGenerator(null, null, null) { @Override/*w ww . ja v a 2 s .c o m*/ protected void writeSource(URI type, ClassName className, Buffer buffer) throws IOException { writeSourceCalled.set(true); } }; ClassName className = generator.generateInternal(mapping.getTarget(), schema, mapping); assertEquals(mapping.getClassName(), className); assertFalse(writeSourceCalled.get()); }
From source file:com.corundumstudio.socketio.annotation.SpringAnnotationScanner.java
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { final AtomicBoolean add = new AtomicBoolean(); ReflectionUtils.doWithMethods(bean.getClass(), new MethodCallback() { @Override/* w w w . ja v a 2 s . c o m*/ public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { add.set(true); } }, new MethodFilter() { @Override public boolean matches(Method method) { for (Class<? extends Annotation> annotationClass : annotations) { if (method.isAnnotationPresent(annotationClass)) { return true; } } return false; } }); if (add.get()) { originalBeanClass = bean.getClass(); } return bean; }
From source file:com.acme.ModuleConfigurationTest.java
@Test public void test() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); Properties properties = new Properties(); properties.put("prefix", "foo"); properties.put("suffix", "bar"); context.getEnvironment().getPropertySources().addLast(new PropertiesPropertySource("options", properties)); context.register(TestConfiguration.class); context.refresh();/* w w w . ja v a 2 s .c o m*/ MessageChannel input = context.getBean("input", MessageChannel.class); SubscribableChannel output = context.getBean("output", SubscribableChannel.class); final AtomicBoolean handled = new AtomicBoolean(); output.subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { handled.set(true); assertEquals("foohellobar", message.getPayload()); } }); input.send(new GenericMessage<String>("hello")); assertTrue(handled.get()); }
From source file:io.vertx.config.git.GitConfigStoreWithGithubTest.java
@After public void tearDown() { AtomicBoolean done = new AtomicBoolean(); if (retriever != null) { retriever.close();// w w w .ja va 2 s. c om } if (git != null) { git.close(); } vertx.close(v -> done.set(true)); await().untilAtomic(done, is(true)); }