Examples of MasterClient


Examples of com.yahoo.ycsb.client.MasterClient

      fileprops.setProperty(prop, props.getProperty(prop));
    }
   
    props = fileprops;
   
    MasterClient client = MasterClient.getMasterClient();
    client.init();
    client.setupSlaves();
    client.execute();
    client.shutdownSlaves();
  }
View Full Code Here

Examples of org.neo4j.kernel.ha.MasterClient

                {
                    broker = new FakeMasterBroker( machineId, placeHolderGraphDb );
                }
                else
                {
                    broker = new FakeSlaveBroker( new MasterClient( "localhost",
                            Protocol.PORT, placeHolderGraphDb ), masterId, machineId, placeHolderGraphDb );
                }
                HighlyAvailableGraphDatabase db = new HighlyAvailableGraphDatabase( storeDir, config,
                        AbstractHaTest.wrapBrokerAndSetPlaceHolderDb( placeHolderGraphDb, broker ) );
                placeHolderGraphDb.setDb( db );
View Full Code Here

Examples of org.neo4j.kernel.ha.MasterClient

    @Override
    protected Broker makeSlaveBroker( MasterImpl master, int masterId, int id, GraphDatabaseService graphDb )
    {
        final Machine masterMachine = new Machine( masterId, -1, 1,//
                "localhost:" + Protocol.PORT );
        final Master client = new MasterClient( masterMachine, graphDb );
        return new AbstractBroker( id, graphDb )
        {
            public boolean iAmMaster()
            {
                return false;
View Full Code Here

Examples of org.neo4j.kernel.ha.MasterClient

    private void invalidateMaster()
    {
        if ( cachedMaster != null )
        {
            MasterClient client = (MasterClient) cachedMaster.first();
            if ( client != null )
            {
                client.shutdown();
            }
            cachedMaster = Pair.<Master, Machine>of( null, Machine.NO_MACHINE );
        }
    }
View Full Code Here

Examples of org.neo4j.kernel.ha.MasterClient

    }

    protected Pair<Master, Machine> getMasterFromZooKeeper( boolean wait )
    {
        Machine master = getMasterBasedOn( getAllMachines( wait ).values() );
        MasterClient masterClient = null;
        if ( cachedMaster.other().getMachineId() != master.getMachineId() )
        {
            invalidateMaster();
            if ( master != Machine.NO_MACHINE && master.getMachineId() != getMyMachineId() )
            {
                masterClient = new MasterClient( master, graphDb );
            }
            cachedMaster = Pair.<Master, Machine>of( masterClient, master );
        }
        return cachedMaster;
    }
View Full Code Here

Examples of org.xtreemfs.babudb.replication.service.clients.MasterClient

    public void run() throws ConnectionLostException, InterruptedException{
        LSN actual = stage.getBabuDB().getState();
        LSN until = (stage.missing == null) ? new LSN(actual.getViewId() + 1,0L) :
                                              stage.missing.end;
               
        MasterClient master = slaveView.getSynchronizationPartner(until);
       
        // make the request and get the result synchronously
        Logging.logMessage(Logging.LEVEL_INFO, stage, "Loading DB since %s from %s.",
                actual.toString(), master.getDefaultServerAddress().toString());
        ClientResponseFuture<DBFileMetaDataSet, DBFileMetaDatas> rp = master.load(actual);
        DBFileMetaDataSet result = null;
        try {
            result = rp.get()
        } catch (ErrorCodeException e) {
            // connection is lost
            throw new ConnectionLostException(e.getMessage(), e.getCode());
        } catch (Exception e) {
            // failure on transmission --> retry
            throw new ConnectionLostException(e.getMessage(), ErrorCode.UNKNOWN);
        }
       
        // switch log file by triggering a manual checkpoint,
        // if the response was empty
        if (result.size() == 0) {
           
            try {
                stage.lastOnView.set(stage.getBabuDB().checkpoint());
            } catch (BabuDBException e) {
                // system failure on switching the lock file --> retry
                Logging.logError(Logging.LEVEL_WARN, this, e);
                return;
            }
            Logging.logMessage(Logging.LEVEL_DEBUG, this,
            "Logfile switched at LSN %s.", stage.getBabuDB().getState().toString());
           
            finished(false);
            return;
        }
       
        // backup the old dbs
        stage.getBabuDB().stopBabuDB();
        try {
            fileIO.backupFiles();
        } catch (IOException e) {
            // file backup failed --> retry
            Logging.logError(Logging.LEVEL_WARN, this, e);
           
            if (stage.isInterrupted()) {
                try {
                    stage.getBabuDB().startBabuDB();
                } catch (BabuDBException e1) {
                    Logging.logError(Logging.LEVEL_ERROR, this, e1);
                }
            }
            return;
        }
       
        // #chunks >= #files
        final AtomicInteger openChunks = new AtomicInteger(result.size());
       
        // request the chunks
        LSN lsn = null;
        for (DBFileMetaData fileData : result) {
           
            // validate the informations
            final String fileName = fileData.file;
            String parentName = new File(fileName).getParentFile().getName();
            if (LSMDatabase.isSnapshotFilename(parentName)) {
                if (lsn == null)
                    lsn = LSMDatabase.getSnapshotLSNbyFilename(parentName);
                else if (!lsn.equals(LSMDatabase.
                        getSnapshotLSNbyFilename(parentName))){
                    Logging.logMessage(Logging.LEVEL_WARN, this,
                            "Indexfiles had ambiguous LSNs: %s",
                            "LOAD will be retried.");
                    return;
                }
            }
            long fileSize = fileData.size;
           
            // if we got an empty file, that cannot be right, so try again
            if (!(fileSize > 0L)) return;
           
            assert (maxChunkSize > 0L) :
                "Empty chunks are not allowed: " + fileName;
           
            synchronized (openChunks) {
                if (openChunks.get() != -1)
                    openChunks.addAndGet((int) (fileSize / maxChunkSize));
            }
               
            // calculate chunks, request them and add them to the list
            long begin = 0L;
            for (long end = maxChunkSize; end < (fileSize+maxChunkSize); end += maxChunkSize) {
                               
                // request the chunk
                final long pos1 = begin;
                final long size = (end > fileSize) ? fileSize : end;
                final ClientResponseFuture<ReusableBuffer, ErrorCodeResponse> chunkRp =
                    master.chunk(fileName, pos1, size);      
                begin = end;
                chunkRp.registerListener(new ClientResponseAvailableListener<ReusableBuffer>() {
               
                    @Override
                    public void responseAvailable(ReusableBuffer buffer) {
View Full Code Here

Examples of org.xtreemfs.babudb.replication.service.clients.MasterClient

        // get the missing logEntries
        ClientResponseFuture<ReusableBuffer[], LogEntries> rp = null;   
        ReusableBuffer[] logEntries = null;
       
       
        MasterClient master = slaveView.getSynchronizationPartner(lsnAtLeast);
       
        Logging.logMessage(Logging.LEVEL_INFO, this, "Replica-Range will be" +
            " retrieved from %s.", master.getDefaultServerAddress());
       
        try {
            rp = master.replica(stage.missing.start, stage.missing.end);
            logEntries = rp.get();
           
            // enhancement if the request had detected a master-failover
            if (logEntries.length == 0) {
                stage.lastOnView.set(stage.getBabuDB().checkpoint());
View Full Code Here

Examples of tachyon.master.MasterClient

  private TachyonFS(InetSocketAddress masterAddress, boolean zookeeperMode) throws IOException {
    mMasterAddress = masterAddress;
    mZookeeperMode = zookeeperMode;
    mAvailableSpaceBytes = 0L;

    mMasterClient = new MasterClient(mMasterAddress, mZookeeperMode);
    mWorkerClient = new WorkerClient(mMasterClient);
  }
View Full Code Here

Examples of tachyon.master.MasterClient

  public WorkerStorage(InetSocketAddress masterAddress, String dataFolder,
      long memoryCapacityBytes) {
    mCommonConf = CommonConf.get();

    mMasterAddress = masterAddress;
    mMasterClient = new MasterClient(mMasterAddress);
    mLocalDataFolder = new File(dataFolder);

    mSpaceCounter = new SpaceCounter(memoryCapacityBytes);
    mLocalUserFolder = new File(mLocalDataFolder, WorkerConf.USER_TEMP_RELATIVE_FOLDER);
  }
View Full Code Here

Examples of tachyon.master.MasterClient

  /**
   * Set a new MasterClient and connect to it.
   */
  public void resetMasterClient() {
    MasterClient tMasterClient = new MasterClient(mMasterAddress);
    mMasterClient = tMasterClient;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.