Java Code Examples for org.apache.commons.lang3.tuple.Pair#setValue()
The following examples show how to use
org.apache.commons.lang3.tuple.Pair#setValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TomcatHessianRegistry.java From tomee with Apache License 2.0 | 6 votes |
@Override public void undeploy(final String hostname, final String app, final String name) { Container host = engine.findChild(hostname); if (host == null) { host = engine.findChild(engine.getDefaultHost()); if (host == null) { throw new IllegalArgumentException("Invalid virtual host '" + engine.getDefaultHost() + "'. Do you have a matchiing Host entry in the server.xml?"); } } final String contextRoot = contextName(app); final Pair<Context, Integer> fakeContext = fakeContexts.get(contextRoot); if (fakeContext != null) { fakeContext.setValue(fakeContext.getValue() - 1); if (fakeContext.getValue() == 0) { fakeContexts.remove(contextRoot); host.removeChild(fakeContext.getKey()); } } }
Example 2
Source File: RenderDroneAI.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
public void update(){ entityItem.age += 4; ChunkPosition lastPos = pos; pos = drone.getTargetedBlock(); if(pos != null) { if(lastPos == null) { oldPos = pos; } else if(!pos.equals(lastPos)) { progress = 0; oldPos = lastPos; } } else { oldPos = null; } progress = Math.min((float)Math.PI, progress + 0.1F); Iterator<Pair<RenderCoordWireframe, Integer>> iterator = blackListWireframes.iterator(); while(iterator.hasNext()) { Pair<RenderCoordWireframe, Integer> wireframe = iterator.next(); wireframe.getKey().ticksExisted++; wireframe.setValue(wireframe.getValue() - 1); if(wireframe.getValue() <= 0) { iterator.remove(); } } }
Example 3
Source File: ApexStreamImpl.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public ApexStream<T> with(DAG.Locality locality) { if (lastBrick.lastStream != null) { for (DagMeta.NodeMeta parent : lastBrick.nodeMeta.getParent()) { Pair<List<Operator.InputPort>, DAG.Locality> p = parent.getNodeStreams().get(lastBrick.lastStream.getLeft()); if (p != null) { p.setValue(locality); } } } return this; }
Example 4
Source File: TomcatHessianRegistry.java From tomee with Apache License 2.0 | 4 votes |
@Override public String deploy(final ClassLoader loader, final HessianServer listener, final String hostname, final String app, final String authMethod, final String transportGuarantee, final String realmName, final String name) throws URISyntaxException { Container host = engine.findChild(hostname); if (host == null) { host = engine.findChild(engine.getDefaultHost()); if (host == null) { throw new IllegalArgumentException("Invalid virtual host '" + engine.getDefaultHost() + "'. Do you have a matchiing Host entry in the server.xml?"); } } final String contextRoot = contextName(app); Context context = Context.class.cast(host.findChild(contextRoot)); if (context == null) { Pair<Context, Integer> fakeContext = fakeContexts.get(contextRoot); if (fakeContext != null) { context = fakeContext.getLeft(); fakeContext.setValue(fakeContext.getValue() + 1); } else { context = Context.class.cast(host.findChild(contextRoot)); if (context == null) { fakeContext = fakeContexts.get(contextRoot); if (fakeContext == null) { context = createNewContext(loader, authMethod, transportGuarantee, realmName, app); fakeContext = new MutablePair<>(context, 1); fakeContexts.put(contextRoot, fakeContext); } else { context = fakeContext.getLeft(); fakeContext.setValue(fakeContext.getValue() + 1); } } } } final String servletMapping = generateServletPath(name); Wrapper wrapper = Wrapper.class.cast(context.findChild(servletMapping)); if (wrapper != null) { throw new IllegalArgumentException("Servlet " + servletMapping + " in web application context " + context.getName() + " already exists"); } wrapper = context.createWrapper(); wrapper.setName(HESSIAN.replace("/", "") + "_" + name); wrapper.setServlet(new OpenEJBHessianServlet(listener)); context.addChild(wrapper); context.addServletMappingDecoded(servletMapping, wrapper.getName()); if ("BASIC".equals(authMethod) && StandardContext.class.isInstance(context)) { final StandardContext standardContext = StandardContext.class.cast(context); boolean found = false; for (final Valve v : standardContext.getPipeline().getValves()) { if (LimitedBasicValve.class.isInstance(v) || BasicAuthenticator.class.isInstance(v)) { found = true; break; } } if (!found) { standardContext.addValve(new LimitedBasicValve()); } } final List<String> addresses = new ArrayList<>(); for (final Connector connector : connectors) { for (final String mapping : wrapper.findMappings()) { final URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), contextRoot + mapping, null, null); addresses.add(address.toString()); } } return HttpUtil.selectSingleAddress(addresses); }