Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
/**
* Assigns a state object to this connection. Connection managers may make
* use of the connection state when allocating persistent connections.
*
* @param state The state object
*/
/**
* Returns the state object associated with this connection.
*
* @return The state object
*/
Object getState() | 0 |
import org.apache.xml.security.utils.XMLUtils;
* @see <A HREF="http://www.w3.org/Signature/Drafts/xmldsig-xfilter2/">XPath Filter v2.0 (editors copy)</A>
/** @inheritDoc */
/** @inheritDoc */
/** @inheritDoc */
/** @inheritDoc */
* @inheritDoc
* @inheritDoc
new CachedXPathFuncHereAPI(input.getCachedXPathAPI().getCachedXPathAPI());
new CachedXPathAPI(input.getCachedXPathAPI().getCachedXPathAPI());
Element xpathElement =XMLUtils.selectNode(
this._transformObject.getElement().getFirstChild(),
XPath2FilterContainer04._TAG_XPATH2,0);
CachedXPathFuncHereAPI.getStrFromNode(xpathContainer.getXPathFilterTextNode()), | 0 |
import org.apache.commons.vfs.provider.FileNameParser;
final FileName zipFileUri,
buffer.append(getOuterName().getURI());
public FileName createName(final String path)
return new ZipFileName(getScheme(), getOuterName(), path); | 0 |
import org.apache.batik.dom.anim.AnimationTarget; | 0 |
parseTierConfig(
"{\"tiers\":{"
+ "\"revocable\": {\"revocable\": true, \"preemptible\": true}"
+ "}}")
.getTiers()); | 0 |
int index = ( key & MASK ) % table.length;
int index = ( key & MASK ) % table.length;
int index = ( key & MASK ) % table.length;
int index = ( key & MASK ) % table.length; | 0 |
import org.apache.beam.sdk.transforms.Combine.AccumulatingCombineFn;
.apply("ProduceDefault", ParDo.withSideInputs(maybeEmptyView).of(
PCollectionTuple split = input.apply("AddNonce", ParDo.of(
new DoFn<KV<K, InputT>, KV<K, InputT>>() {
transient int counter;
@Override
public void startBundle(Context c) {
counter = ThreadLocalRandom.current().nextInt(
Integer.MAX_VALUE);
}
@Override
public void processElement(ProcessContext c) {
KV<K, InputT> kv = c.element();
int spread = Math.max(1, hotKeyFanout.apply(kv.getKey()));
if (spread <= 1) {
c.output(kv);
} else {
int nonce = counter++ % spread;
c.sideOutput(hot, KV.of(KV.of(kv.getKey(), nonce), kv.getValue()));
}
}
})
.apply("StripNonce", ParDo.of(
.apply("PrepareCold", ParDo.of( | 0 |
final List<String> warnings = new ArrayList<>();
final List<String> infoMessages = new ArrayList<>(); | 0 |
import com.google.cloud.dataflow.sdk.util.TimeDomain;
c.timers().deleteTimer(c.window().maxTimestamp(), TimeDomain.EVENT_TIME); | 0 |
import org.apache.felix.moduleloader.*;
public ICapability[] m_capabilities = null;
public IRequirement[] m_requirements = null;
public IRequirement[] m_dynamicRequirements = null;
ICapability[] capabilities, IRequirement[] requirements,
IRequirement[] dynamicRequirements, R4Library[] libraries)
m_capabilities = capabilities;
m_requirements = requirements;
m_dynamicRequirements = dynamicRequirements;
public ICapability[] getCapabilities()
// TODO: RB - These should probably all return copies of the array.
return m_capabilities;
public IRequirement[] getRequirements()
return m_requirements;
public IRequirement[] getDynamicRequirements()
return m_dynamicRequirements; | 0 |
import org.apache.ambari.server.AmbariException;
public Map<String, HostConfig> getDesiredHostConfigs(Cluster cluster) throws AmbariException; | 0 |
import org.apache.cocoon.util.AbstractLogEnabled;
public class SimpleSitemapExecutor extends AbstractLogEnabled
implements ThreadSafe, SitemapExecutor {
* @see SitemapExecutor#invokeAction(ExecutionContext, Map, Action, org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.lang.String, Parameters) | 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger log = LoggerFactory.getLogger(MockInstanceOperations.class); | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/decorators/Attic/UnmodifiableCollection.java,v 1.2 2003/05/05 23:25:22 rwaldhoff Exp $
* @version $Revision: 1.2 $ $Date: 2003/05/05 23:25:22 $ | 0 |
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ | 0 |
@Override | 0 |
* A function that decides which key values are stored in a tables sample. As Accumuo compacts data
* and creates rfiles it uses a Sampler to decided what to store in the rfiles sample section. The
* class name of the Sampler and the Samplers configuration are stored in each rfile. A scan of a
* tables sample will only succeed if all rfiles were created with the same sampler and sampler
* configuration.
* Since the decisions that Sampler makes are persisted, the behavior of a Sampler for a given
* configuration should always be the same. One way to offer a new behavior is to offer new options,
* while still supporting old behavior with a Samplers existing options.
* Ideally a sampler that selects a Key k1 would also select updates for k1. For example if a
* Sampler selects :
* {@code row='000989' family='name' qualifier='last' visibility='ADMIN' time=9 value='Doe'}, it
* would be nice if it also selected :
* {@code row='000989' family='name' qualifier='last' visibility='ADMIN' time=20 value='Dough'}.
* Using hash and modulo on the key fields is a good way to accomplish this and
* {@link AbstractHashSampler} provides a good basis for implementation.
* An implementation of Sampler must have a noarg constructor. After construction this method is
* called once to initialize a sampler before it is used.
* @return True if the key (and its associtated value) should be stored in the rfile's sample.
* Return false if it should not be included. | 0 |
Copyright 2001,2003 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/ | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
private static ServiceMediator c_services;
private Listener m_listener;
public void start(BundleContext bundleContext) throws Exception
c_services = new ServiceMediator();
c_services.activate(bundleContext);
m_listener = new Listener();
m_listener.activate(bundleContext);
public void stop(BundleContext bundleContext) throws Exception
if (m_listener != null)
m_listener.deactivate();
m_listener = null;
if (c_services != null)
c_services.deactivate();
c_services = null;
static ServiceMediator getServices()
return c_services;
} | 0 |
import org.apache.beam.sdk.options.ValueProvider;
abstract ValueProvider<String> getProjectId();
abstract ValueProvider<String> getInstanceId();
abstract ValueProvider<String> getDatabaseId();
abstract Builder setProjectId(ValueProvider<String> projectId);
abstract Builder setInstanceId(ValueProvider<String> instanceId);
abstract Builder setDatabaseId(ValueProvider<String> databaseId);
return withProjectId(ValueProvider.StaticValueProvider.of(projectId));
}
public Write withProjectId(ValueProvider<String> projectId) {
return withInstanceId(ValueProvider.StaticValueProvider.of(instanceId));
}
public Write withInstanceId(ValueProvider<String> instanceId) {
return withDatabaseId(ValueProvider.StaticValueProvider.of(databaseId));
}
public Write withDatabaseId(ValueProvider<String> databaseId) {
DatabaseId.of(projectId(), spec.getInstanceId().get(), spec.getDatabaseId().get()));
: spec.getProjectId().get();
spannerOptionsBuider.setProjectId(spec.getProjectId().get()); | 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.systemready.rootcause;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.runtime.ServiceComponentRuntime;
import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
@Component(
service = RootCauseCommand.class,
property = {
"osgi.command.scope=ready", //
"osgi.command.function=rootcause"
}
)
public class RootCauseCommand {
@Reference
ServiceComponentRuntime scr;
public DSComp rootcause(String componentName) {
ComponentDescriptionDTO cdesc = scr.getComponentDescriptionDTOs().stream()
.filter(desc -> desc.name.equals(componentName))
.findFirst().get();
DSComp rootCause = new DSRootCause(scr).getRootCause(cdesc);
new RootCausePrinter().print(rootCause);
return rootCause;
}
} | 0 |
package org.apache.felix.sigil.model.osgi;
import org.apache.felix.sigil.model.common.VersionRange; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MessageOperationTag.java,v 1.3 2003/10/09 21:21:20 rdonkin Exp $
* $Revision: 1.3 $
* $Date: 2003/10/09 21:21:20 $
* any, must include the following acknowledgement:
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
* permission of the Apache Software Foundation.
* $Id: MessageOperationTag.java,v 1.3 2003/10/09 21:21:20 rdonkin Exp $
* @version $Revision: 1.3 $ | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at | 1 |
super(definition);
if (!getCombinedState().isAcceptingInputs())
return;
if (!getCombinedState().isAcceptingInputs())
return true;
| 0 |
import org.apache.cocoon.Constants;
context.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new MockContext()); | 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
LoggerFactory.getLogger(QuorumPeerTestBase.class); | 0 |
public java.awt.image.RenderedImage createRendering
(java.awt.image.renderable.RenderContext rc){ | 0 |
public MockServerCnxn() {
super(null);
}
void disableRecv(boolean waitDisableRecv) { | 0 |
import org.apache.http.client.utils.CloneUtils;
import org.apache.http.message.HeaderGroup;
import org.apache.http.params.HttpParams;
implements HttpUriRequest, AbortableHttpRequest, Cloneable {
private Lock abortLock;
public boolean isAborted() {
return this.aborted;
}
@Override
public Object clone() throws CloneNotSupportedException {
HttpRequestBase clone = (HttpRequestBase) super.clone();
clone.abortLock = new ReentrantLock();
clone.aborted = false;
clone.releaseTrigger = null;
clone.connRequest = null;
clone.headergroup = (HeaderGroup) CloneUtils.clone(this.headergroup);
clone.params = (HttpParams) CloneUtils.clone(this.params);
return clone;
}
| 0 |
EndOfWindowBroadcast eowBroadcast =
// ~ no need for broad-casts upong "batched and attached windowing"
windowing == null || windowing == BatchWindowing.get()
? new EndOfWindowBroadcast.NoopInstance()
: new EndOfWindowBroadcast.NotifyingInstance();
reduceStateByKey.input().isBounded(), eowBroadcast)); | 0 |
import static java.util.Objects.requireNonNull;
requireNonNull(tableId, "Invalid argument: null tableId");
requireNonNull(iterators, "Invalid argument: null iterator list");
requireNonNull(compactionStrategy, "Invalid argument: null compactionStrategy"); | 0 |
import org.apache.ambari.server.api.services.AmbariMetaInfo;
private String projectVersion;
public BootStrapImpl(Configuration conf, AmbariMetaInfo ambariMetaInfo) throws IOException {
this.projectVersion = ambariMetaInfo.getServerVersion();
this.masterHostname, info.isVerbose(), this.clusterOsType, this.projectVersion); | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at | 1 |
meanTemps.apply(Mean.globally()).apply(View.asSingleton()); | 0 |
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.cocoon.components.ContextHelper;
* @version CVS $Id: CopletSource.java,v 1.8 2004/04/19 14:47:31 cziegeler Exp $
implements Source, XMLizable, Serviceable, Contextualizable {
protected Context context;
/* (non-Javadoc)
* @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
*/
public void contextualize(Context context) throws ContextException {
this.context = context;
}
ServiceManager sitemapManager = (ServiceManager) this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
ServiceSelector serializerSelector = null;
Serializer serializer = null;
try {
serializerSelector = (ServiceSelector) sitemapManager.lookup(Serializer.ROLE+"Selector");
serializer = (Serializer) serializerSelector.select("xml");
ByteArrayOutputStream os = new ByteArrayOutputStream();
serializer.setOutputStream(os);
this.toSAX(serializer);
return new ByteArrayInputStream(os.toByteArray());
} catch (SAXException se) {
throw new CascadingIOException("Unable to stream content.", se);
} catch (ServiceException ce) {
throw new CascadingIOException("Unable to get components for serializing.", ce);
} finally {
if ( serializer != null ) {
serializerSelector.release(serializer);
}
sitemapManager.release(serializerSelector);
} catch (ContextException ce) {
throw new CascadingIOException("Unable to get service manager.", ce); | 0 |
* @version $Id$
* @throws java.util.NoSuchElementException if the iteration is finished | 0 |
import org.apache.hc.core5.util.TimeValue;
execRuntime.markConnectionReusable(null, TimeValue.NEG_ONE_MILLISECONDS); | 0 |
import org.apache.excalibur.source.SourceNotFoundException;
*
* <p>
* Instead of src attribute, source can be specified using
*
* matches the supplied functionality.
* @version CVS $Id: ResourceExistsAction.java,v 1.4 2003/12/12 14:33:09 vgritsenko Exp $
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception {
String resourceURI = parameters.getParameter("url", src);
Source source = null;
source = resolver.resolveURI(resourceURI);
if (source.exists()) {
return EMPTY_MAP;
}
} catch (SourceNotFoundException e) {
// Do not log
getLogger().warn("Exception resolving resource " + resourceURI, e);
if (source != null) {
resolver.release(source);
} | 0 |
import com.google.inject.Singleton;
| 0 |
@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) | 0 |
).getCounters(), | 0 |
* or more contributor license agreements. See the NOTICE file
* regarding copyright ownership. The ASF licenses this file
* with the License. You may obtain a copy of the License at
* KIND, either express or implied. See the License for the | 0 |
* The link activation listeners.
*/
protected List linkActivationListeners = new LinkedList();
/**
* Adds a LinkActivationListener to this component.
*/
public void addLinkActivationListener(LinkActivationListener l) {
linkActivationListeners.add(l);
}
/**
* Removes a LinkActivationListener from this component.
*/
public void removeLinkActivationListener(LinkActivationListener l) {
linkActivationListeners.remove(l);
}
/**
fireLinkActivatedEvent(elt, href);
fireLinkActivatedEvent(elt, newURI.toString());
fireLinkActivatedEvent(elt, href);
* Fires a LinkActivatedEvent.
*/
protected void fireLinkActivatedEvent(SVGAElement elt, String href) {
Object[] ll = linkActivationListeners.toArray();
if (ll.length > 0) {
LinkActivationEvent ev;
ev = new LinkActivationEvent(JSVGComponent.this, elt, href);
for (int i = 0; i < ll.length; i++) {
LinkActivationListener l = (LinkActivationListener)ll[i];
l.linkActivated(ev);
}
}
}
/** | 0 |
import org.junit.Assert;
import org.junit.Test;
@Test
Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
Assert.assertNotNull(sessionRequest.getSession());
Assert.assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
Assert.assertEquals(0, requestConns.getCount());
Assert.assertEquals(openClientConns.get(), closedClientConns.get());
Assert.assertEquals(openServerConns.get(), closedServerConns.get());
@Test
Assert.assertNotNull(ex);
Assert.assertTrue(ex instanceof IOReactorException);
Assert.assertNotNull(ex.getCause());
Assert.assertTrue(ex.getCause() instanceof OoopsieRuntimeException);
Assert.assertNotNull(auditlog);
Assert.assertEquals(1, auditlog.size());
Assert.assertEquals(IOReactorStatus.SHUT_DOWN, this.server.getStatus());
@Test
Assert.assertEquals(0, requestConns.getCount());
Assert.assertNotNull(ex);
Assert.assertTrue(ex instanceof IOReactorException);
Assert.assertNotNull(ex.getCause());
Assert.assertTrue(ex.getCause() instanceof OoopsieRuntimeException);
Assert.assertNotNull(auditlog);
Assert.assertEquals(1, auditlog.size());
Assert.assertEquals(IOReactorStatus.SHUT_DOWN, this.server.getStatus());
@Test
Assert.assertEquals(0, requestConns.getCount());
Assert.assertEquals(IOReactorStatus.ACTIVE, this.server.getStatus());
Assert.assertNull(this.server.getException()); | 0 |
import javax.servlet.ServletContextListener;
import com.google.inject.Module;
import com.google.inject.Provider;
import com.google.inject.util.Modules;
import static org.apache.aurora.scheduler.http.JettyServerModule.makeServletContextListener;
/**
* Subclasses should override with a module that configures the servlets they are testing.
*
* @return A module used in the creation of the servlet container's child injector.
*/
protected Module getChildServletModule() {
return Modules.EMPTY_MODULE;
}
public void setUpBase() throws Exception {
createMock(new Clazz<DynamicHostSet<ServiceInstance>>() { });
bind(ServletContextListener.class).toProvider(new Provider<ServletContextListener>() {
@Override
public ServletContextListener get() {
return makeServletContextListener(injector, getChildServletModule());
}
});
}
},
new JettyServerModule(false)); | 0 |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(TaskVars.class);
LOG.warn("Failed to find rack attribute associated with host " + host); | 0 |
import org.apache.accumulo.server.util.TableDiskUsage;
Map<TreeSet<String>,Long> diskUsage = TableDiskUsage.getDiskUsage(new ServerConfiguration(instance).getConfiguration(), tableIds, fs, conn); | 1 |
assertEquals(Optional.absent(), select(ROLE_A));
assertQuotas(ImmutableMap.of());
assertEquals(Optional.absent(), select(ROLE_B));
assertEquals(Optional.absent(), select(ROLE_A));
assertEquals(Optional.absent(), select(ROLE_B));
assertQuotas(ImmutableMap.of());
assertEquals(Optional.absent(), select(ROLE_A));
assertQuotas(ImmutableMap.of());
assertEquals(Optional.absent(), select(ROLE_A));
assertQuotas(ImmutableMap.of()); | 0 |
* <p></p> | 0 |
(KeyedCombineFn) combineFn, | 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.jxpath.ri.jx177;
import org.apache.commons.jxpath.Variables;
public class JXPathVariablesResolver implements Variables
{
private static final long serialVersionUID = -1106360826446119597L;
public static final String ROOT_VAR = "__root";
private final Object root;
public JXPathVariablesResolver(Object root)
{
this.root = root;
}
public boolean isDeclaredVariable(String varName)
{
if (varName == null)
{
throw new IllegalArgumentException("varName");
}
return varName.equals(ROOT_VAR);
}
public Object getVariable(String varName)
{
if (varName == null)
{
throw new IllegalArgumentException("varName");
}
if (!varName.equals(ROOT_VAR))
{
throw new IllegalArgumentException("Variable is not declared: " + varName);
}
return root;
}
public void declareVariable(String varName, Object value)
{
throw new UnsupportedOperationException();
}
public void undeclareVariable(String varName)
{
throw new UnsupportedOperationException();
}
} | 0 |
* Copyright (c) 2001-2004 The Apache Software Foundation. All rights
* @version $Id: VMSFTPEntryParser.java,v 1.10 2004/01/02 03:39:05 scohen Exp $ | 0 |
public ArrayListValuedHashMap(int initialListCapacity) {
public ArrayListValuedHashMap(int initialMapCapacity, int initialListCapacity) {
private void writeObject(ObjectOutputStream oos) throws IOException {
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { | 0 |
import java.util.function.Supplier;
import org.apache.felix.dm.Logger;
import org.apache.felix.dm.context.ComponentContext;
* An event for a service dependency.
* Not thread safe, but this class is assumed to be used under the protection of the component serial queue.
private final ServiceReference<?> m_reference;
private final AtomicBoolean m_closed = new AtomicBoolean(false);
/**
* Our logger.
*/
private final Logger m_logger;
/**
* The actual service.
*/
private volatile Object m_service;
public ServiceEventImpl(ComponentContext ctx, ServiceReference<?> reference, Object service) {
m_service = service;
m_bundle = ctx.getBundle();
m_bundleContext = ctx.getBundleContext();
m_logger = ctx.getLogger();
}
/**
* Returns the actual service, or null if the service reference is invalid.
* @return the service or null if the service is not available anymore.
*/
@SuppressWarnings("unchecked")
@Override
public <T> T getEvent() {
if (m_service == null) {
try {
m_service = m_bundleContext.getService(m_reference);
if (m_service == null) {
debug(() -> "Service " + m_reference + " unavailable");
}
} catch (Exception t) {
error(() -> "Could not get service from service reference " + m_reference, t);
}
}
return (T) m_service;
}
public ServiceReference<?> getReference() {
if (m_closed.compareAndSet(false, true)) {
if (m_service != null) {
try {
m_bundleContext.ungetService(m_reference);
} catch (IllegalStateException e) {}
}
private void error(Supplier<String> msg, Exception err) {
if (m_logger != null) {
m_logger.err("%s", err, msg.get());
}
}
private void debug(Supplier<String> msg) {
if (m_logger != null) {
m_logger.debug("%s", msg.get());
}
} | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//digester/src/java/org/apache/commons/digester/plugins/Declaration.java,v 1.4 2003/10/27 13:37:35 rdonkin Exp $
* $Revision: 1.4 $
* $Date: 2003/10/27 13:37:35 $
public Declaration(String pluginClassName) { | 0 |
} finally {
client.close(); | 0 |
public Thread newThread(final Runnable r) {
for (final Thread thread : createdThreads) { | 0 |
EasyMock.expect(mockBundleContext.getProperty(DirectoryWatcher.CONFIG_ENCODING)).andReturn(null); | 0 |
private Map<PInput, PInput> aliasCollections = new HashMap<>();
while (aliasCollections.containsKey(input)) {
input = aliasCollections.get(input);
}
/**
* Set the given output as alias for another input,
* i.e. there won't be a stream representation in the target DAG.
* @param alias
* @param source
*/
public void addAlias(PValue alias, PInput source) {
aliasCollections.put(alias, source);
}
| 0 |
public final class MapEntryUtils {
private MapEntryUtils() {
throw new UnsupportedOperationException("No instance"); | 0 |
task.getAssignedTask().getTask(),
Tasks.id(task)); | 0 |
@Override
protected Object getPropertyInternal(String key) | 0 |
public static Map toRelationshipAttributes(Map map) {
if (map != null && map.containsKey("typeName") && map.containsKey("relationshipAttributes") && map.get("relationshipAttributes") instanceof Map) {
return (Map)map.get("relationshipAttributes");
}
return map;
}
| 1 |
ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex());
ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex());
ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex());
ConstantCP cmr = (ConstantCP) cp.getConstant(super.getIndex()); | 0 |
* @param str
public String encode(String str) throws EncoderException {
return this.encode(str, getCharset());
* @param str
public String decode(String str, Charset charset) throws DecoderException {
if (str == null) {
return new String(this.decode(StringUtils.getBytesUsAscii(str)), charset);
* @param str
public String decode(String str, String charset) throws DecoderException, UnsupportedEncodingException {
if (str == null) {
return new String(decode(StringUtils.getBytesUsAscii(str)), charset);
* @param str
public String decode(String str) throws DecoderException {
return this.decode(str, this.getCharset());
* @param obj
public Object encode(Object obj) throws EncoderException {
if (obj == null) {
} else if (obj instanceof byte[]) {
return encode((byte[]) obj);
} else if (obj instanceof String) {
return encode((String) obj);
obj.getClass().getName() +
* @param obj
public Object decode(Object obj) throws DecoderException {
if (obj == null) {
} else if (obj instanceof byte[]) {
return decode((byte[]) obj);
} else if (obj instanceof String) {
return decode((String) obj);
obj.getClass().getName() +
* @param str
* the charset for str
public String encode(String str, Charset charset) {
if (str == null) {
return StringUtils.newStringUsAscii(this.encode(str.getBytes(charset)));
* @param str
* the charset for str
public String encode(String str, String charset) throws UnsupportedEncodingException {
if (str == null) {
return StringUtils.newStringUsAscii(encode(str.getBytes(charset))); | 0 |
package org.apache.atlas.repository.converters; | 0 |
public final class CodeExceptionGen
implements InstructionTargeter, Cloneable, java.io.Serializable { | 0 |
import org.apache.beam.runners.spark.SparkPipelineOptions;
import org.apache.beam.runners.spark.translation.streaming.utils.TestPipelineOptions;
public final TestPipelineOptions pipelineOptions = new TestPipelineOptions();
@Rule
Pipeline p = Pipeline.create(pipelineOptions.getOptions()); | 0 |
statusBar.setMainMessage(resources.getString("Document.loading"));
statusBar.setMainMessage(resources.getString("Document.creating")); | 0 |
* @param timestamp the timestamp for which the trigger event was scheduled.
* @param window the window this action is invoked for; i.e. the context of the invocation | 0 |
@Override
void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException {
case '"' :
app.append("\\\"");
break;
case '\\' :
app.append("\\\\");
break;
case '\b' :
app.append("\\b");
break;
case '\f' :
app.append("\\f");
break;
case '\n' :
app.append("\\n");
break;
case '\r' :
app.append("\\r");
break;
case '\t' :
app.append("\\t");
break;
default :
if (Character.isISOControl(c)) {
app.append("\\u");
app.append("0123456789ABCDEF".charAt(0xF & (c >> 12)));
app.append("0123456789ABCDEF".charAt(0xF & (c >> 8)));
app.append("0123456789ABCDEF".charAt(0xF & (c >> 4)));
app.append("0123456789ABCDEF".charAt(0xF & (c >> 0)));
} else
app.append(c);
case '"' :
instring = true;
break;
case '[' :
case '{' :
level++;
break;
case ']' :
case '}' :
level--;
break;
case '"' :
instring = false;
break;
case '\\' :
sb.append((char) isr.read());
break; | 0 |
HttpRoute ROUTE1 = new HttpRoute(TARGET1);
setMaxConnectionsPerHost(null, ROUTE1, 3);
setMaxConnectionsPerHost(params, ROUTE1, 0);
getMaxConnectionsPerHost(null, ROUTE1);
getMaxConnectionsPerHost(params, ROUTE1);
getMaxConnectionsPerHost(params, ROUTE1); | 0 |
* @return the bytes
* @return the Text of the textNode
public String getTextFromChildElement(String localname, String namespace) { | 0 |
synchronized (this)
synchronized (this)
synchronized (this)
synchronized (this)
synchronized (this) | 0 |
/*
* Copyright 2016-2018 Seznam.cz, a.s. | 0 |
import java.util.List;
public void testWrap_NewLine2() {
List wrapped = HelpFormatter.wrap("A really quite long general description of the option with specific alternatives documented:\n"+
" Indented special case\n"+
" Alternative scenario", 30);
final Iterator i =
wrapped.iterator();
assertEquals("A really quite long general", i.next());
assertEquals("description of the option", i.next());
assertEquals("with specific alternatives", i.next());
assertEquals("documented:", i.next());
assertEquals(" Indented special case", i.next());
assertEquals(" Alternative scenario", i.next());
assertFalse(i.hasNext());
} | 0 |
private FactoryUtils() {} | 0 |
@SuppressWarnings({ "rawtypes", "unchecked" }) | 0 |
chooser = Property.createInstanceFromPropertyName(conf, Property.GENERAL_VOLUME_CHOOSER, VolumeChooser.class, new RandomVolumeChooser()); | 0 |
import org.apache.felix.sigil.common.osgi.VersionRange; | 0 |
* @version CVS $Id: Part.java,v 1.2 2003/04/17 20:11:24 haul Exp $
* Returns the original filename
*/
public String getUploadName(){
return (String) headers.get("filename");
}
/** | 0 |
* Factory policy : CUSTOMIZED.
* Custom creation strategy
*/
public static final int CUSTOM_STRATEGY = -1;
/**
* Service providing policy.
*/
private final int m_policy;
/**
private final CreationStrategy m_strategy;
CreationStrategy strategy;
if (creationStrategyClass == null) {
m_policy = factoryPolicy;
} else {
m_policy = CUSTOM_STRATEGY;
}
strategy = (CreationStrategy) creationStrategyClass.newInstance();
strategy = null;
strategy = null;
strategy = new SingletonStrategy();
strategy = new FactoryStrategy();
strategy = new PerInstanceStrategy();
strategy = null;
m_strategy = strategy;
for (Property prop : props) {
addProperty(prop);
public int getPolicy() {
return m_policy;
}
public Class<? extends CreationStrategy> getCreationStrategy() {
return m_strategy.getClass();
}
| 0 |
validateConditionIsNotEmpty(condition);
validateConditionIsNotEmpty(condition);
validateConditionIsNotEmpty(condition);
private void validateConditionIsNotEmpty(Condition condition) {
throw new IllegalArgumentException("No filter criteria specified."); | 0 |
import org.apache.zookeeper.server.util.OSMXBean;
OSMXBean osMbean = new OSMXBean();
if (osMbean.getUnix() == false) {
long initialFdCount = osMbean.getOpenFileDescriptorCount();
long currentCount = osMbean.getOpenFileDescriptorCount(); | 0 |
private final Log log = LogFactory.getLog(LRUFilesCache.class); | 0 |
expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
.andReturn(false)
.once();
expect(kerberosHelper.getForceToggleKerberosDirective(null))
.andReturn(false)
.once();
expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
.andReturn(false)
.once();
expect(kerberosHelper.getForceToggleKerberosDirective(anyObject(Map.class)))
.andReturn(false)
.once(); | 0 |
// clear pending revalidations
pendingRevalidations.clear(); | 0 |
Assert.assertTrue(executionCommand.getRoleParams().containsKey(KeyNames.PACKAGE_LIST));
Assert.assertTrue(executionCommand.getRoleParams().containsKey("stack_id")); | 0 |
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated
@Deprecated | 1 |
VALUEOUT reducedValue = reducer.apply(new IteratorIterable<>(
Iterators.transform(input.iterator(), e -> e.get().getValue())));
new MultiWindowedElement<>(Collections.emptySet(), Pair.of(key, reducedValue)); | 0 |
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.parser;
/**
* This interface must be implemented and then registred as the
* handler of a <code>PointsParser</code> instance in order to be
* notified of parsing events.
*
* @author <a href="mailto:[email protected]">Stephane Hillion</a>
* @version $Id$
*/
public interface PointsHandler {
/**
* Invoked when the points attribute starts.
* @exception ParseException if an error occured while processing the
* points
*/
void startPoints() throws ParseException;
/**
* Invoked when a point has been parsed.
* @param x, y the coordinates of the point
* @exception ParseException if an error occured while processing the
* points
*/
void point(float x, float y) throws ParseException;
/**
* Invoked when the points attribute ends.
* @exception ParseException if an error occured while processing the
* points
*/
void endPoints() throws ParseException;
} | 0 |
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableList; | 0 |
import org.apache.http.client.config.CookieSpecs;
CookieSpecs.DEFAULT,
new BestMatchSpecFactory());
registry.register( | 0 |
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at | 0 |
import org.apache.hc.core5.http.StreamClosedException;
throw new StreamClosedException("Stream already closed");
throw new StreamClosedException("Stream already closed"); | 0 |
super();
/**
* Splits a string into a number of tokens.
*
* @param text the text to split
* @return the tokens, never null
*/
// used by wildcardMatch
// package level so a unit test may run on this
| 0 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
: 0L;
setCounterValue(metrics);
private static void setCounterValue(Long value){
counterValue = value;
} | 0 |
/*
* ====================================================================
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.auth;
public enum AuthChallengeState {
UNCHALLENGED, CHALLENGED, FAILURE, SUCCESS
} | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.