Codota Logo
OracleServer
Code IndexAdd Codota to your IDE (free)

How to use
OracleServer
in
io.fluo.core.oracle

Best Java code snippets using io.fluo.core.oracle.OracleServer (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: io.fluo/fluo-mini

@Override
public void close() {
 try {
  if (oserver != null) {
   notificationFinder.stop();
   mnp.close();
   oserver.stop();
   env.close();
   reporter.close();
   if (cluster != null) {
    cluster.stop();
   }
  }
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}
origin: io.fluo/fluo-core

private synchronized long getTimestampsImpl(String id, int num) throws TException {
 if (!started) {
  throw new IllegalStateException("Received timestamp request but Oracle has not started");
 }
 if (!id.equals(env.getFluoApplicationID())) {
  throw new IllegalArgumentException("Received timestamp request with a Fluo application ID ["
    + id + "] that does not match the application ID [" + env.getFluoApplicationID()
    + "] of the Oracle");
 }
 if (!isLeader) {
  throw new IllegalStateException("Received timestamp request but Oracle is not leader");
 }
 try {
  while (num + currentTs >= maxTs) {
   allocateTimestamp();
  }
  long tmp = currentTs;
  currentTs += num;
  return tmp;
 } catch (Exception e) {
  throw new TException(e);
 }
}
origin: io.fluo/fluo-core

@Override
public Stamps getTimestamps(String id, int num) throws TException {
 long start = getTimestampsImpl(id, num);
 // do this outside of sync
 stampsHistogram.update(num);
 return new Stamps(start, gcTsTracker.advertisedGcTimetamp);
}
origin: io.fluo/fluo-cluster

env.getConfiguration().print();
OracleServer server = new OracleServer(env);
server.start();
server.stop();
origin: io.fluo/fluo-mini

public MiniFluoImpl(FluoConfiguration fluoConfig) {
 if (!fluoConfig.hasRequiredMiniFluoProps()) {
  throw new IllegalArgumentException("MiniFluo configuration is not valid");
 }
 config = fluoConfig;
 try {
  if (config.getMiniStartAccumulo()) {
   startMiniAccumulo();
  }
  config.setProperty(FluoConfigurationImpl.MIN_SLEEP_TIME_PROP, 50);
  config.setProperty(FluoConfigurationImpl.MAX_SLEEP_TIME_PROP, 100);
  env = new Environment(config);
  reporter = FluoClientImpl.setupReporters(env, "mini", reporterCounter);
  oserver = new OracleServer(env);
  oserver.start();
  mnp = new MiniNotificationProcessor(env);
  notificationFinder = NotificationFinderFactory.newNotificationFinder(env.getConfiguration());
  notificationFinder.init(env, mnp);
  notificationFinder.start();
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}
origin: io.fluo/fluo-core

@Override
public void childEvent(CuratorFramework curatorFramework, PathChildrenCacheEvent event)
  throws Exception {
 try {
  if (isConnected()
    && (event.getType().equals(PathChildrenCacheEvent.Type.CHILD_ADDED)
      || event.getType().equals(PathChildrenCacheEvent.Type.CHILD_REMOVED) || event
      .getType().equals(PathChildrenCacheEvent.Type.CHILD_UPDATED))) {
   synchronized (this) {
    Participant participant = leaderSelector.getLeader();
    if (isLeader(participant) && !leaderSelector.hasLeadership()) {
     // in case current instance becomes leader, we want to know who came before it.
     currentLeader = participant;
    }
   }
  }
 } catch (InterruptedException e) {
  log.warn("Oracle leadership watcher has been interrupted unexpectedly");
 }
}
origin: io.fluo/fluo-core

int port = Integer.parseInt(address[1]);
OracleService.Client client = getOracleClient(host, port);
if (client != null) {
 try {
origin: io.fluo/fluo-core

public synchronized void start() throws Exception {
 if (started) {
  throw new IllegalStateException();
 }
 final InetSocketAddress addr = startServer();
 curatorFramework = CuratorUtil.newAppCurator(env.getConfiguration());
 curatorFramework.getConnectionStateListenable().addListener(cnxnListener);
 curatorFramework.start();
 while (!cnxnListener.isConnected()) {
  Thread.sleep(200);
 }
 leaderSelector = new LeaderSelector(curatorFramework, ZookeeperPath.ORACLE_SERVER, this);
 String leaderId = HostUtil.getHostName() + ":" + addr.getPort();
 leaderSelector.setId(leaderId);
 log.info("Leader ID = " + leaderId);
 leaderSelector.start();
 pathChildrenCache = new PathChildrenCache(curatorFramework, oraclePath, true);
 pathChildrenCache.getListenable().addListener(this);
 pathChildrenCache.start();
 while (!cnxnListener.isConnected()) {
  Thread.sleep(200);
 }
 log.info("Listening " + addr);
 started = true;
}
io.fluo.core.oracleOracleServer

Javadoc

Oracle server is the responsible for providing incrementing logical timestamps to clients. It should never give the same timestamp to two clients and it should always provide an incrementing timestamp.

If multiple oracle servers are run, they will choose a leader and clients will automatically connect to that leader. If the leader goes down, the client will automatically fail over to the next leader. In the case where an oracle fails over, the next oracle will begin a new block of timestamps.

Most used methods

  • <init>
  • start
  • stop
  • allocateTimestamp
  • getOracleClient
  • getTimestampsImpl
  • isConnected
  • isLeader
  • startServer

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now