code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public synchronized void refreshToken()
{
final String refreshToken = this.response.refresh_token;
this.response = null;
this.cachedInfo = null;
final String responseStr = authService.getToken(UserManagerOAuthService.GRANT_TYPE_REFRESH_TOKEN,
null,
... | java |
public static void loadFromXmlPluginPackageDefinitions(final IPluginRepository repo, final ClassLoader cl, final InputStream in)
throws PluginConfigurationException {
for (PluginDefinition pd : loadFromXmlPluginPackageDefinitions(cl, in)) {
repo.addPluginDefinition(pd);
}
} | java |
@SuppressWarnings("unchecked")
public static Collection<PluginDefinition> loadFromXmlPluginPackageDefinitions(final ClassLoader cl, final InputStream in)
throws PluginConfigurationException {
List<PluginDefinition> res = new ArrayList<PluginDefinition>();
DocumentBuilderFactory factory... | java |
public static PluginDefinition parseXmlPluginDefinition(final ClassLoader cl, final InputStream in) throws PluginConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document document;
try {
DocumentBuilder loader = factory.newDocumentBui... | java |
@SuppressWarnings("rawtypes")
private static PluginDefinition parsePluginDefinition(final ClassLoader cl, final Element plugin) throws PluginConfigurationException {
// Check if the plugin definition is inside its own file
if (getAttributeValue(plugin, "definedIn", false) != null) {
Str... | java |
@SuppressWarnings("rawtypes")
private static void parseCommandLine(final PluginDefinition pluginDef, final Element xmlPluginElement) {
Element commandLine = xmlPluginElement.element("command-line");
if (commandLine != null) {
// The plugin has a command line...
Element optio... | java |
private static PluginOption parsePluginOption(final Element option) {
PluginOption po = new PluginOption();
po.setArgName(option.attributeValue("argName"));
po.setArgsCount(Integer.valueOf(option.attributeValue("argsCount", "1")));
po.setArgsOptional(Boolean.valueOf(option.attributeValue... | java |
private static PluginOption parsePluginOption(final Option option) {
PluginOption po = new PluginOption();
po.setArgName(option.argName());
po.setArgsOptional(option.optionalArgs());
po.setDescription(option.description());
po.setHasArgs(option.hasArgs());
po.setLongOpt(o... | java |
@Override
public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable
{
// Get an instance of the implementing class via Guice
final Object instance = registry.getInjector().getInstance(clazz);
return thisMethod.invoke(instance, args);
} | java |
public static void main(String[] args) throws Exception
{
final String name = args[0];
final File sslCert = new File(args[1]);
final File sslKey = new File(args[2]);
final Map<File, Integer> foldersAndPorts = getFoldersAndPorts(3, args);
NginxSiteGenerator generator = new NginxSiteGenerator();
final Stri... | java |
public MultiXSDSchemaFiles encode()
{
MultiXSDSchemaFiles files = new MultiXSDSchemaFiles();
for (Map.Entry<String, DOMResult> entry : schemas.entrySet())
{
MultiXSDSchemaFile file = new MultiXSDSchemaFile();
file.name = entry.getKey();
file.schema = getElement(entry.getValue().getNode());
files.f... | java |
@Provides
@Singleton
@Named(GuiceProperties.REST_SERVICES_PREFIX)
public String getRestServicesPrefix(ServletContext context)
{
String restPath = context.getInitParameter(RESTEASY_MAPPING_PREFIX);
if (restPath == null || restPath.isEmpty() || restPath.equals("/"))
{
return "";
}
else
{
return res... | java |
@Provides
@Singleton
@Named(GuiceProperties.LOCAL_REST_SERVICES_ENDPOINT)
public URI getRestServicesEndpoint(@Named(GuiceProperties.STATIC_ENDPOINT_CONFIG_NAME) URI webappUri,
@Named(GuiceProperties.REST_SERVICES_PREFIX) String restPrefix,
Servl... | java |
@Provides
@Singleton
@Named(GuiceProperties.STATIC_ENDPOINT_CONFIG_NAME)
public URI getRestServicesEndpoint(LocalEndpointDiscovery localEndpointDiscovery)
{
final URI base = localEndpointDiscovery.getLocalEndpoint();
return base;
} | java |
public List<Class<?>> getSiblingClasses(final Class<?> clazz, boolean recursive, final Predicate<Class<?>> predicate)
{
return getClasses(getPackages(clazz)[0], recursive, predicate);
} | java |
public String[] getCommandLine() {
String[] argsAry = argsString != null ? split(argsString) : EMPTY_ARRAY;
List<String> argsList = new ArrayList<String>();
int startIndex = 0;
for (CommandOption opt : optionsList) {
String argName = opt.getName();
String argVal... | java |
private void parse(final String definition) throws BadThresholdException {
String[] thresholdComponentAry = definition.split(",");
for (String thresholdComponent : thresholdComponentAry) {
String[] nameValuePair = thresholdComponent.split("=");
if (nameValuePair.length != 2 || ... | java |
public final String getRangesAsString(final Status status) {
List<String> ranges = new ArrayList<String>();
List<Range> rangeList;
switch (status) {
case OK:
rangeList = okThresholdList;
break;
case WARNING:
rangeList = warningThresholdList;
... | java |
public static BundleClassLoader newPriviledged( final Bundle bundle, final ClassLoader parent )
{
return AccessController.doPrivileged( new PrivilegedAction<BundleClassLoader>()
{
public BundleClassLoader run()
{
return new BundleClassLoader( bundle, parent );... | java |
@Override
@SuppressWarnings("unchecked")
protected Enumeration<URL> findResources( final String name )
throws IOException
{
Enumeration<URL> resources = m_bundle.getResources( name );
// Bundle.getResources may return null, in such case return empty enumeration
if( resources ... | java |
public final void call(T param)
{
if (!run)
{
run = true;
prepared = true;
try
{
this.run(param);
}
catch (Throwable t)
{
log.error("[ParamInvokeable] {prepare} : " + t.getMessage(), t);
}
}
} | java |
public synchronized List<GuiceRecurringDaemon> getRecurring()
{
return daemons.stream()
.filter(d -> d instanceof GuiceRecurringDaemon)
.map(d -> (GuiceRecurringDaemon) d)
.sorted(Comparator.comparing(GuiceDaemon::getName))
.collect(Collectors.toList())... | java |
public static final byte[] fromHex(final String value)
{
if (value.length() == 0)
return new byte[0];
else if (value.indexOf(':') != -1)
return fromHex(':', value);
else if (value.length() % 2 != 0)
throw new IllegalArgumentException("Invalid hex specified: uneven number of digits passed for byte[] conv... | java |
private String getHttpResponse(final ICommandLine cl, final String hostname, final String port, final String method, final String path,
final int timeout, final boolean ssl, final List<Metric> metrics) throws MetricGatheringException {
Properties props = null;
try {
props = getRe... | java |
private String checkRedirectResponse(final URL url, final String method, final Integer timeout, final Properties props, final String postData,
final String redirect, final boolean ignoreBody, final List<Metric> metrics) throws Exception {
// @todo handle sticky/port and follow param options
... | java |
private List<Metric> analyzeResponse(final ICommandLine opt, final String response, final int elapsed) throws MetricGatheringException {
List<Metric> metrics = new ArrayList<Metric>();
metrics.add(new Metric("time", "", new BigDecimal(elapsed), null, null));
if (!opt.hasOption("certificate")) {... | java |
private Properties getRequestProperties(final ICommandLine cl, final String method) throws UnsupportedEncodingException {
Properties props = new Properties();
if (cl.hasOption("useragent")) {
props.setProperty("User-Agent", cl.getOptionValue("useragent"));
} else {
props.... | java |
private String getPostData(final ICommandLine cl) throws Exception {
// String encoded = "";
StringBuilder encoded = new StringBuilder();
String data = cl.getOptionValue("post");
if (data == null) {
return null;
}
String[] values = data.split("&");
for... | java |
private void checkCertificateExpiryDate(URL url, List<Metric> metrics) throws Exception {
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0], new TrustManager[] { new DefaultTrustManager() }, new SecureRandom());
SSLContext.setDefault(ctx);
HttpsURLConnection conn... | java |
public static JNRPEConfiguration createConfiguration(final String configurationFilePath) throws ConfigurationException {
JNRPEConfiguration conf = null;
if (configurationFilePath.toLowerCase().endsWith(".conf") || configurationFilePath.toLowerCase().endsWith(".ini")) {
conf = new IniJNRPECo... | java |
public static BundleContext getBundleContext( final Bundle bundle )
{
try
{
// first try to find the getBundleContext method (OSGi spec >= 4.10)
final Method method = Bundle.class.getDeclaredMethod( "getBundleContext" );
if( !method.isAccessible() )
{
... | java |
public static Bundle getBundle( BundleContext bc, String symbolicName )
{
return getBundle( bc, symbolicName, null );
} | java |
public static List<Bundle> getBundles( BundleContext bc, String symbolicName )
{
List<Bundle> bundles = new ArrayList<Bundle>();
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
bundles.add( bundle );
... | java |
public static Bundle getBundle( BundleContext bc, String symbolicName, String version )
{
for( Bundle bundle : bc.getBundles() )
{
if( bundle.getSymbolicName().equals( symbolicName ) )
{
if( version == null || version.equals( bundle.getVersion() ) )
... | java |
public String encodeValue()
{
switch (function)
{
case EQ:
if (value != null && value.startsWith("_"))
return function.getPrefix() + value;
else
return value;
default:
if (function.hasBinaryParam())
return function.getPrefix() + value + ".." + value2;
else if (function.hasParam... | java |
public static WQConstraint decode(final String field, final String rawValue)
{
final WQFunctionType function;
final String value;
if (StringUtils.equalsIgnoreCase(rawValue, WQFunctionType.IS_NULL.getPrefix()))
return new WQConstraint(field, WQFunctionType.IS_NULL, null);
else if (StringUtils.equalsIgnoreCa... | java |
private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException {
Metric metric = null;
try {
Map<String, Integer> status = getSlaveStatus(conn);
if (status.isEmpty()) {
mysql.closeConnection(conn);
... | java |
private Map<String, Integer> getSlaveStatus(final Connection conn) throws SQLException {
Map<String, Integer> map = new HashMap<String, Integer>();
String query = SLAVE_STATUS_QRY;
Statement statement = null;
ResultSet rs = null;
try {
if (conn != null) {
... | java |
public void updateCRC() {
this.crc32 = 0;
CRC32 crcAlg = new CRC32();
crcAlg.update(this.toByteArray());
this.crc32 = (int) crcAlg.getValue();
} | java |
private static Stage configureParser() {
Stage startStage = new StartStage();
Stage negativeInfinityStage = new NegativeInfinityStage();
Stage positiveInfinityStage = new PositiveInfinityStage();
NegateStage negateStage = new NegateStage();
BracketStage.OpenBracketStage openBrace... | java |
public static void parse(final String range, final RangeConfig tc) throws RangeException {
if (range == null) {
throw new RangeException("Range can't be null");
}
ROOT_STAGE.parse(range, tc);
checkBoundaries(tc);
} | java |
private static void checkBoundaries(final RangeConfig rc) throws RangeException {
if (rc.isNegativeInfinity()) {
// No other checks necessary. Negative infinity is less than any
// number
return;
}
if (rc.isPositiveInfinity()) {
// No other checks... | java |
public TimecodeBuilder withTimecode(Timecode timecode)
{
return this
.withNegative(timecode.isNegative())
.withDays(timecode.getDaysPart())
.withHours(timecode.getHoursPart())
.withMinutes(timecode.getMinutesPart())
.withSeconds(timecode.getSecondsPart())
... | java |
public Timecode build()
{
// If drop-frame is not specified (and timebase is drop frame capable) default to true
final boolean dropFrame = (this.dropFrame != null) ? this.dropFrame.booleanValue() : getRate().canBeDropFrame();
return new Timecode(negative, days, hours, minutes, seconds, frames, rate, dropFrame);... | java |
public void setAll(final String name,
final String email,
final Map<String, Map<String, ConfigPropertyValue>> data,
final String message)
{
set(name, email, data, ConfigChangeMode.WIPE_ALL, message);
} | java |
public void set(final String name,
final String email,
final Map<String, Map<String, ConfigPropertyValue>> data,
final ConfigChangeMode changeMode,
final String message)
{
try
{
RepoHelper.write(repo, name, email, data, changeMode, message);
... | java |
public static HttpCallContext get() throws IllegalStateException
{
final HttpCallContext ctx = peek();
if (ctx != null)
return ctx;
else
throw new IllegalStateException("Not in an HttpCallContext!");
} | java |
public static HttpCallContext set(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)
{
final HttpCallContext ctx = new HttpCallContext(generateTraceId(request), request, response, servletContext);
contexts.set(ctx);
return ctx;
} | java |
public static void filterP12(File p12, String p12Password) throws IOException
{
if (!p12.exists())
throw new IllegalArgumentException("p12 file does not exist: " + p12.getPath());
final File pem;
if (USE_GENERIC_TEMP_DIRECTORY)
pem = File.createTempFile(UUID.randomUUID().toString(), "");
else
pem = n... | java |
public <T> T runUnchecked(Retryable<T> operation) throws RuntimeException
{
try
{
return run(operation);
}
catch (RuntimeException e)
{
throw e;
}
catch (Exception e)
{
throw new RuntimeException("Retryable " + operation + " failed: " + e.getMessage(), e);
}
} | java |
public void trace(final IJNRPEExecutionContext ctx, final String message) {
postEvent(ctx, new LogEvent(source, LogEventType.TRACE, message));
} | java |
public void debug(final IJNRPEExecutionContext ctx, final String message) {
postEvent(ctx, new LogEvent(source, LogEventType.DEBUG, message));
} | java |
public void info(final IJNRPEExecutionContext ctx, final String message) {
postEvent(ctx, new LogEvent(source, LogEventType.INFO, message));
} | java |
public void warn(final IJNRPEExecutionContext ctx, final String message) {
postEvent(ctx, new LogEvent(source, LogEventType.WARNING, message));
} | java |
@Override
public Map<RuleSet, List<Rule>> matching(Rules rules,
Map<String, Object> vars,
boolean ignoreMethodErrors) throws OgnlException
{
Map<RuleSet, List<Rule>> ret = new HashMap<>();
for (RuleSet ruleSet : rules.ruleSets)
... | java |
private List<Rule> match(final RuleSet ruleSet, final OgnlContext ognlContext) throws OgnlException
{
log.debug("Assessing input for ruleset : " + ruleSet.id);
//run the input commands
ruleSet.runInput(ognlContext);
final List<Rule> ret = new ArrayList<>();
//assess each rule against the input, return any... | java |
public JNRPE build() {
JNRPE jnrpe = new JNRPE(pluginRepository, commandRepository, charset, acceptParams, acceptedHosts, maxAcceptedConnections, readTimeout,
writeTimeout);
IJNRPEEventBus eventBus = jnrpe.getExecutionContext().getEventBus();
for (Object obj : eventList... | java |
public ResteasyClient getOrCreateClient(final boolean fastFail,
final AuthScope authScope,
final Credentials credentials,
final boolean preemptiveAuth,
fina... | java |
public Consumer<HttpClientBuilder> createHttpClientCustomiser(final boolean fastFail,
final AuthScope authScope,
final Credentials credentials,
... | java |
public CloseableHttpClient createHttpClient(final Consumer<HttpClientBuilder> customiser)
{
final HttpClientBuilder builder = HttpClientBuilder.create();
// By default set long call timeouts
{
RequestConfig.Builder requestBuilder = RequestConfig.custom();
requestBuilder.setConnectTimeout((int) connection... | java |
public StorageSize multiply(BigInteger by)
{
final BigInteger result = getBits().multiply(by);
return new StorageSize(getUnit(), result);
} | java |
public StorageSize subtract(StorageSize that)
{
StorageUnit smallestUnit = StorageUnit.smallest(this.getUnit(), that.getUnit());
final BigInteger a = this.getBits();
final BigInteger b = that.getBits();
final BigInteger result = a.subtract(b);
return new StorageSize(smallestUnit, result);
} | java |
private boolean isHtmlAcceptable(HttpServletRequest request)
{
@SuppressWarnings("unchecked") final List<String> accepts = ListUtility.list(ListUtility.iterate(request.getHeaders(
HttpHeaderNames.ACCEPT)));
for (String accept : accepts)
{
if (StringUtils.startsWithIgnoreCase(accept, "text/html"))
ret... | java |
public static Injector createInjector(final PropertyFile configuration, final GuiceSetup setup)
{
return new GuiceBuilder().withConfig(configuration).withSetup(setup).build();
} | java |
public String getMessage() {
if (performanceDataList.isEmpty()) {
return messageString;
}
StringBuilder res = new StringBuilder(messageString).append('|');
for (PerformanceData pd : performanceDataList) {
res.append(pd.toPerformanceString()).append(' ');
}... | java |
private void start(final ResourceInstanceEntity instance)
{
azure.start(instance.getProviderInstanceId());
instance.setState(ResourceInstanceState.PROVISIONING);
} | java |
private void stop(final ResourceInstanceEntity instance)
{
azure.stop(instance);
instance.setState(ResourceInstanceState.DISCARDING);
} | java |
private void updateState(final ResourceInstanceEntity instance)
{
ResourceInstanceState actual = azure.determineState(instance);
instance.setState(actual);
} | java |
@Override
public void userEventTriggered(final ChannelHandlerContext ctx, final Object evt) {
if (evt instanceof IdleStateEvent) {
IdleStateEvent e = (IdleStateEvent) evt;
if (e.state() == IdleState.READER_IDLE) {
ctx.close();
LOG.warn(jnrpeContext, "R... | java |
static String truncatePath(String path, String commonPrefix)
{
final int nextSlash = path.indexOf('/', commonPrefix.length());
final int nextOpenCurly = path.indexOf('{', commonPrefix.length());
if (nextSlash > 0)
return path.substring(0, nextSlash);
else if (nextOpenCurly > 0)
return path.substring(0, ... | java |
public void setFilterGUIDs(List<String> filterGUIDs)
{
int i = 0;
for (String filterGUID : filterGUIDs)
{
// Remove filters (we're replacing them)
removeFilter("Filter_" + i);
// Build a new Filter_0 element
Element filter = buildFilterElement("Filter_" + i, filterGUID);
element.addContent(filt... | java |
public static OgnlEvaluator getInstance(final Object root, final String expression)
{
final OgnlEvaluatorCollection collection = INSTANCE.getEvaluators(getRootClass(root));
return collection.get(expression);
} | java |
public static PropertyFile find(final ClassLoader classloader, final String... fileNames)
{
URL resolvedResource = null;
String resolvedFile = null;
for (String fileName : fileNames)
{
if (fileName.charAt(0) == '/')
{
File file = new File(fileName);
if (file.exists())
{
try
{
... | java |
private List<Class<?>> getClassesByDiscriminators(Collection<String> discriminators)
{
Map<String, Class<?>> entitiesByName = new HashMap<>();
// Prepare a Map of discriminator name -> entity class
for (QEntity child : entity.getSubEntities())
{
entitiesByName.put(child.getDiscriminatorValue(), child.getEn... | java |
@Override
public Expression<?> getProperty(final WQPath path)
{
final JPAJoin join = getOrCreateJoin(path.getTail());
return join.property(path.getHead().getPath());
} | java |
@Override
public JPAJoin getOrCreateJoin(final WQPath path)
{
if (path == null)
return new JPAJoin(criteriaBuilder, entity, root, false);
if (!joins.containsKey(path.getPath()))
{
final JPAJoin parent = getOrCreateJoin(path.getTail());
final JPAJoin join = parent.join(path.getHead().getPath());
j... | java |
public boolean hasCollectionFetch()
{
if (fetches != null)
for (String fetch : fetches)
{
QEntity parent = entity;
final String[] parts = StringUtils.split(fetch, '.');
for (int i = 0; i < parts.length; i++)
{
// If this is a fully supported relation then continue checking
if (paren... | java |
public Timecode subtract(SampleCount samples)
{
final SampleCount mySamples = getSampleCount();
final SampleCount result = mySamples.subtract(samples);
return Timecode.getInstance(result, dropFrame);
} | java |
public Timecode add(SampleCount samples)
{
final SampleCount mySamples = getSampleCount();
final SampleCount totalSamples = mySamples.add(samples);
return TimecodeBuilder.fromSamples(totalSamples, dropFrame).build();
} | java |
public Timecode addPrecise(SampleCount samples) throws ResamplingException
{
final SampleCount mySamples = getSampleCount();
final SampleCount totalSamples = mySamples.addPrecise(samples);
return TimecodeBuilder.fromSamples(totalSamples, dropFrame).build();
} | java |
public void addCommand(final String commandName, final String pluginName, final String commandLine) {
commandsList.add(new Command(commandName, pluginName, commandLine));
} | java |
public List<ManifestEntry> scan( final Bundle bundle )
{
NullArgumentException.validateNotNull( bundle, "Bundle" );
final Dictionary bundleHeaders = bundle.getHeaders();
if( bundleHeaders != null && !bundleHeaders.isEmpty() )
{
return asManifestEntryList( m_manifestFilte... | java |
public double resample(final double samples, final Timebase oldRate)
{
if (samples == 0)
{
return 0;
}
else if (!this.equals(oldRate))
{
final double resampled = resample(samples, oldRate, this);
return resampled;
}
else
{
return samples;
}
} | java |
private RestException buildKnown(Constructor<RestException> constructor, RestFailure failure)
{
try
{
return constructor.newInstance(failure.exception.detail, null);
}
catch (Exception e)
{
return buildUnknown(failure);
}
} | java |
private UnboundRestException buildUnknown(RestFailure failure)
{
// We need to build up exception detail that reasonably accurately describes the source exception
final String msg = failure.exception.shortName + ": " + failure.exception.detail + " (" + failure.id + ")";
return new UnboundRestException(msg);
} | java |
public static ByteBuffer blockingRead(SocketChannel so, long timeout, byte[] bytes) throws IOException
{
ByteBuffer b = ByteBuffer.wrap(bytes);
if (bytes.length == 0)
return b;
final long timeoutTime = (timeout > 0) ? (System.currentTimeMillis() + timeout) : (Long.MAX_VALUE);
while (b.remaining() != 0 &&... | java |
public <T> T deserialise(final Class<T> clazz, final InputSource source)
{
final Object obj = deserialise(source);
if (clazz.isInstance(obj))
return clazz.cast(obj);
else
throw new JAXBRuntimeException("XML deserialised to " + obj.getClass() + ", could not cast to the expected " + clazz);
} | java |
public <T> T deserialise(final Class<T> clazz, final String xml)
{
final Object obj = deserialise(new InputSource(new StringReader(xml)));
if (clazz.isInstance(obj))
return clazz.cast(obj);
else
throw new JAXBRuntimeException("XML deserialised to " + obj.getClass() + ", could not cast to the expected " + ... | java |
public Document serialiseToDocument(final Object obj)
{
final Document document = DOMUtils.createDocumentBuilder().newDocument();
serialise(obj, document);
return document;
} | java |
public void reload()
{
try
{
final Execed process = Exec.rootUtility(new File(binPath, "nginx-reload").getAbsolutePath());
process.waitForExit(new Timeout(30, TimeUnit.SECONDS).start(), 0);
}
catch (IOException e)
{
throw new RuntimeException("Error executing nginx-reload command", e);
}
} | java |
public void reconfigure(final String config)
{
try
{
final File tempFile = File.createTempFile("nginx", ".conf");
try
{
FileHelper.write(tempFile, config);
final Execed process = Exec.rootUtility(new File(binPath, "nginx-reconfigure").getAbsolutePath(),
... | java |
public void installCertificates(final String key, final String cert, final String chain)
{
try
{
final File keyFile = File.createTempFile("key", ".pem");
final File certFile = File.createTempFile("cert", ".pem");
final File chainFile = File.createTempFile("chain", ".pem");
try
{
FileHelper.writ... | java |
public static PropertyFile get(Class<?> clazz)
{
try
{
// If we get a guice-enhanced class then we should go up one level to get the class name from the user's code
if (clazz.getName().contains("$$EnhancerByGuice$$"))
clazz = clazz.getSuperclass();
final String classFileName = clazz.getSimpleName() +... | java |
private static void saveClass(final ClassLoader cl, final Class c) {
if (LOADED_PLUGINS.get(cl) == null) {
LOADED_PLUGINS.put(cl, new ClassesData());
}
ClassesData cd = LOADED_PLUGINS.get(cl);
cd.addClass(c);
} | java |
public static Class getClass(final ClassLoader cl, final String className) throws ClassNotFoundException {
if (LOADED_PLUGINS.get(cl) == null) {
LOADED_PLUGINS.put(cl, new ClassesData());
}
ClassesData cd = LOADED_PLUGINS.get(cl);
Class clazz = cd.getClass(className);
... | java |
final Status evaluate(final Metric metric) {
if (metric == null || metric.getMetricValue() == null) {
throw new NullPointerException("Metric value can't be null");
}
IThreshold thr = thresholdsMap.get(metric.getMetricName());
if (thr == null) {
return Status.OK;... | java |
public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException {
Process p = Runtime.getRuntime().exec(command);
StreamManager sm = new StreamManager();
try {
InputStream input = sm.handle(p.getInputStream());
StringBuffer lines = new Stri... | java |
public synchronized Thread startThread(String name) throws IllegalThreadStateException
{
if (!running)
{
log.info("[Daemon] {startThread} Starting thread " + name);
this.running = true;
thisThread = new Thread(this, name);
thisThread.setDaemon(shouldStartAsDaemon()); // Set whether we're a daemon threa... | java |
public synchronized void stopThread()
{
if (isRunning())
{
if (log.isInfoEnabled())
log.info("[Daemon] {stopThread} Requesting termination of thread " + thisThread.getName());
this.running = false;
synchronized (this)
{
this.notifyAll();
}
}
else
{
throw new IllegalThreadStateExce... | java |
@Inject
public void guiceSetupComplete()
{
// Force us to re-register with guice-supplied values
this.registered = false;
// Normally guice would call this but we must call it manually because the object was created manually
postConstruct();
if (onGuiceTakeover != null)
{
onGuiceTakeover.run();
o... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.