/** * Create a DistributedLogManager for <i>nameOfLogStream</i>, with default shared clients. * * @param nameOfLogStream * name of log stream * @return distributedlog manager * @throws com.twitter.distributedlog.exceptions.InvalidStreamNameException if stream name is invalid * @throws IOException */ public DistributedLogManager createDistributedLogManagerWithSharedClients(String nameOfLogStream) throws InvalidStreamNameException, IOException { return createDistributedLogManager(nameOfLogStream, ClientSharingOption.SharedClients); }
Optional<DynamicDistributedLogConfiguration> dynamicStreamConfiguration) throws InvalidStreamNameException, IOException { return namespace.createDistributedLogManager( nameOfLogStream, clientSharingOption,
/** * Create a DistributedLogManager for <i>nameOfLogStream</i>, with specified client sharing options. * * @param nameOfLogStream * name of log stream. * @param clientSharingOption * specifies if the ZK/BK clients are shared * @return distributedlog manager instance. * @throws com.twitter.distributedlog.exceptions.InvalidStreamNameException if stream name is invalid * @throws IOException */ public DistributedLogManager createDistributedLogManager( String nameOfLogStream, ClientSharingOption clientSharingOption) throws InvalidStreamNameException, IOException { Optional<DistributedLogConfiguration> logConfiguration = Optional.absent(); Optional<DynamicDistributedLogConfiguration> dynamicLogConfiguration = Optional.absent(); return createDistributedLogManager( nameOfLogStream, clientSharingOption, logConfiguration, dynamicLogConfiguration); }
throw new UnsupportedOperationException("Use DistributedLogNamespace methods for federated namespace"); return createDistributedLogManager( namespace, nameOfLogStream,
@Override public void deleteLog(String logName) throws InvalidStreamNameException, LogNotFoundException, IOException { validateName(logName); Optional<URI> uri = FutureUtils.result(metadataStore.getLogLocation(logName)); if (!uri.isPresent()) { throw new LogNotFoundException("Log " + logName + " isn't found."); } DistributedLogManager dlm = createDistributedLogManager( uri.get(), logName, ClientSharingOption.SharedClients, Optional.<DistributedLogConfiguration>absent(), Optional.<DynamicDistributedLogConfiguration>absent()); dlm.delete(); }
@Override public DistributedLogManager openLog(String logName, Optional<DistributedLogConfiguration> logConf, Optional<DynamicDistributedLogConfiguration> dynamicLogConf) throws InvalidStreamNameException, IOException { validateName(logName); Optional<URI> uri = FutureUtils.result(metadataStore.getLogLocation(logName)); if (!uri.isPresent()) { throw new LogNotFoundException("Log " + logName + " isn't found."); } return createDistributedLogManager( uri.get(), logName, ClientSharingOption.SharedClients, logConf, dynamicLogConf); }
for (int s = 0; s < count; s++) { if (shareBK) { dlms[s] = namespace.createDistributedLogManager(name + String.format("%d", s), DistributedLogManagerFactory.ClientSharingOption.SharedClients); } else { dlms[s] = namespace.createDistributedLogManager(name + String.format("%d", s), DistributedLogManagerFactory.ClientSharingOption.SharedZKClientPerStreamBKClient); dlms[0] = namespace.createDistributedLogManager(name + String.format("%d", 0), DistributedLogManagerFactory.ClientSharingOption.SharedClients); } else { dlms[0] = namespace.createDistributedLogManager(name + String.format("%d", 0), DistributedLogManagerFactory.ClientSharingOption.SharedZKClientPerStreamBKClient);
BKDistributedLogManager bkdlm1 = (BKDistributedLogManager)namespace.createDistributedLogManager("perstream1", DistributedLogManagerFactory.ClientSharingOption.PerStreamClients); BKDistributedLogManager bkdlm2 = (BKDistributedLogManager)namespace.createDistributedLogManager("perstream2", DistributedLogManagerFactory.ClientSharingOption.PerStreamClients); BKDistributedLogManager bkdlm1 = (BKDistributedLogManager)namespace.createDistributedLogManager("sharedZK1", DistributedLogManagerFactory.ClientSharingOption.SharedZKClientPerStreamBKClient); BKDistributedLogManager bkdlm2 = (BKDistributedLogManager)namespace.createDistributedLogManager("sharedZK2", DistributedLogManagerFactory.ClientSharingOption.SharedZKClientPerStreamBKClient); BKDistributedLogManager bkdlm1 = (BKDistributedLogManager)namespace.createDistributedLogManager("sharedBoth1", DistributedLogManagerFactory.ClientSharingOption.SharedClients); BKDistributedLogManager bkdlm2 = (BKDistributedLogManager)namespace.createDistributedLogManager("sharedBoth2", DistributedLogManagerFactory.ClientSharingOption.SharedClients);