Skip to content

Commit

Permalink
replaced ServiceRegistry with ServiceLoader. issue #3402
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Feb 27, 2015
1 parent 953ae30 commit 231e9bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Expand Up @@ -19,13 +19,6 @@
*/
package com.orientechnologies.common.console;

import com.orientechnologies.common.console.annotation.ConsoleCommand;
import com.orientechnologies.common.console.annotation.ConsoleParameter;
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.parser.OStringParser;
import com.orientechnologies.common.util.OArrays;

import javax.imageio.spi.ServiceRegistry;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
Expand All @@ -40,10 +33,17 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.ServiceLoader;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.orientechnologies.common.console.annotation.ConsoleCommand;
import com.orientechnologies.common.console.annotation.ConsoleParameter;
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.parser.OStringParser;
import com.orientechnologies.common.util.OArrays;

public class OConsoleApplication {
protected static final String[] COMMENT_PREFIXS = new String[] { "#", "--", "//" };
protected final StringBuilder commandBuffer = new StringBuilder(2048);
Expand Down Expand Up @@ -454,7 +454,7 @@ protected void syntaxError(String iCommand, Method m) {
protected Map<Method, Object> getConsoleMethods() {

// search for declared command collections
final Iterator<OConsoleCommandCollection> ite = ServiceRegistry.lookupProviders(OConsoleCommandCollection.class);
final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator();
final Collection<Object> candidates = new ArrayList<Object>();
candidates.add(this);
while (ite.hasNext()) {
Expand Down
Expand Up @@ -20,12 +20,12 @@

package com.orientechnologies.common.util;

import java.util.Iterator;
import java.util.ServiceLoader;

import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.exception.OConfigurationException;

import javax.imageio.spi.ServiceRegistry;
import java.util.Iterator;

public class OClassLoaderHelper {

/**
Expand All @@ -47,7 +47,7 @@ public static synchronized <T extends Object> Iterator<T> lookupProviderWithOrie
final ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(orientClassLoader);
try {
return ServiceRegistry.lookupProviders(clazz);
return ServiceLoader.load(clazz).iterator();
} catch (Exception e) {
OLogManager.instance().warn(null, "Cannot lookup in service registry", e);
throw new OConfigurationException("Cannot lookup in service registry", e);
Expand Down

0 comments on commit 231e9bd

Please sign in to comment.