code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private void getFKStatement(StringBuffer a) {
if (!getName().isReservedName()) {
a.append(Tokens.T_CONSTRAINT).append(' ');
a.append(getName().statementName);
a.append(' ');
}
a.append(Tokens.T_FOREIGN).append(' ').append(Tokens.T_KEY);
int[] col = ... | java |
private static void getColumnList(Table t, int[] col, int len,
StringBuffer a) {
a.append('(');
for (int i = 0; i < len; i++) {
a.append(t.getColumn(col[i]).getName().statementName);
if (i < len - 1) {
a.append(',');
... | java |
private static String getActionString(int action) {
switch (action) {
case Constraint.RESTRICT :
return Tokens.T_RESTRICT;
case Constraint.CASCADE :
return Tokens.T_CASCADE;
case Constraint.SET_DEFAULT :
return Tokens.T_SET ... | java |
boolean isUniqueWithColumns(int[] cols) {
if (constType != UNIQUE || core.mainCols.length != cols.length) {
return false;
}
return ArrayUtil.haveEqualSets(core.mainCols, cols, cols.length);
} | java |
boolean isEquivalent(Table mainTable, int[] mainCols, Table refTable,
int[] refCols) {
if (constType != Constraint.MAIN
&& constType != Constraint.FOREIGN_KEY) {
return false;
}
if (mainTable != core.mainTable || refTable != core.refTable) {... | java |
void updateTable(Session session, Table oldTable, Table newTable,
int colIndex, int adjust) {
if (oldTable == core.mainTable) {
core.mainTable = newTable;
if (core.mainIndex != null) {
core.mainIndex =
core.mainTable.getIndex(cor... | java |
void checkInsert(Session session, Table table, Object[] row) {
switch (constType) {
case CHECK :
if (!isNotNull) {
checkCheckConstraint(session, table, row);
}
return;
case FOREIGN_KEY :
PersistentSto... | java |
boolean checkHasMainRef(Session session, Object[] row) {
if (ArrayUtil.hasNull(row, core.refCols)) {
return false;
}
PersistentStore store =
session.sessionData.getRowStore(core.mainTable);
boolean exists = core.mainIndex.exists(session, store, row,
... | java |
void checkReferencedRows(Session session, Table table, int[] rowColArray) {
Index mainIndex = getMainIndex();
PersistentStore store = session.sessionData.getRowStore(table);
RowIterator it = table.rowIterator(session);
while (true) {
Row row = it.ge... | java |
@VisibleForTesting
static int chooseTableSize(int setSize) {
if (setSize == 1) {
return 2;
}
// Correct the size for open addressing to match desired load factor.
// Round up to the next highest power of 2.
int tableSize = Integer.highestOneBit(setSize - 1) << 1;
while (tableSize * DESIR... | java |
@Override
public String[] decode(long generation, String tableName, List<VoltType> types, List<String> names, String[] to, Object[] fields) throws RuntimeException {
Preconditions.checkArgument(
fields != null && fields.length > m_firstFieldOffset,
"null or inapropriately siz... | java |
Iv2InFlight findHandle(long ciHandle)
{
assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId());
/*
* Check the partition specific queue of handles
*/
int partitionId = getPartIdFromHandle(ciHandle);
PartitionInFlightTracker ... | java |
void freeOutstandingTxns() {
assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId());
for (PartitionInFlightTracker tracker : m_trackerMap.values()) {
for (Iv2InFlight inflight : tracker.m_inFlights.values()) {
m_outstandingTxns--;
... | java |
void loadSchema(Reader reader, Database db, DdlProceduresToLoad whichProcs)
throws VoltCompiler.VoltCompilerException {
int currLineNo = 1;
DDLStatement stmt = getNextStatement(reader, m_compiler, currLineNo);
while (stmt != null) {
// Some statements are processed by Vo... | java |
private String generateDDLForDRConflictsTable(Database currentDB, Database previousDBIfAny, boolean isCurrentXDCR) {
StringBuilder sb = new StringBuilder();
if (isCurrentXDCR) {
createDRConflictTables(sb, previousDBIfAny);
} else {
dropDRConflictTablesIfNeeded(sb);
... | java |
private void processCreateStreamStatement(DDLStatement stmt, Database db, DdlProceduresToLoad whichProcs)
throws VoltCompilerException {
String statement = stmt.statement;
Matcher statementMatcher = SQLParser.matchCreateStream(statement);
if (statementMatcher.matches()) {
... | java |
private void fillTrackerFromXML()
{
for (VoltXMLElement e : m_schema.children) {
if (e.name.equals("table")) {
String tableName = e.attributes.get("name");
String partitionCol = e.attributes.get("partitioncolumn");
String export = e.attributes.get(... | java |
private static boolean indexesAreDups(Index idx1, Index idx2) {
// same attributes?
if (idx1.getType() != idx2.getType()) {
return false;
}
if (idx1.getCountable() != idx2.getCountable()) {
return false;
}
if (idx1.getUnique() != idx2.getUnique()) ... | java |
private void addConstraintToCatalog(Table table,
VoltXMLElement node,
Map<String, String> indexReplacementMap,
Map<String, Index> indexMap)
throws VoltCompilerException
{
assert node.name.equals("constraint");
String name = node.attributes.get("name")... | java |
private static AbstractExpression buildPartialIndexPredicate(
AbstractParsedStmt dummy, String indexName,
VoltXMLElement predicateXML, Table table,
VoltCompiler compiler) throws VoltCompilerException {
// Make sure all column expressions refer to the same index table
... | java |
public Result getLob(Session session, long lobID, long offset,
long length) {
throw Error.runtimeError(ErrorCode.U_S0500, "LobManager");
} | java |
@Override
public void close() throws SQLException
{
try
{
isClosed = true;
JDBC4ClientConnectionPool.dispose(NativeConnection);
}
catch(Exception x)
{
throw SQLError.get(x);
}
} | java |
@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java |
@Override
public Statement createStatement() throws SQLException
{
checkClosed();
try
{
return new JDBC4Statement(this);
}
catch(Exception x)
{
throw SQLError.get(x);
}
} | java |
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java |
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java |
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
if ((resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet.TYPE_FORWARD_ONLY) &&
resultSetConcurrency == ResultSet.CONCUR_READ_ONL... | java |
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java |
@Override
public void rollback() throws SQLException
{
checkClosed();
if (props.getProperty(ROLLBACK_THROW_EXCEPTION, "true").equalsIgnoreCase("true")) {
throw SQLError.noSupport();
}
} | java |
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException
{
checkClosed();
// Always true - error out only if the client is trying to set somethign else
if (!autoCommit && (props.getProperty(COMMIT_THROW_EXCEPTION, "true").equalsIgnoreCase("true"))) {
throw ... | java |
@Override
public void setReadOnly(boolean readOnly) throws SQLException
{
checkClosed();
if (!Boolean.parseBoolean(props.getProperty("enableSetReadOnly","false"))){
throw SQLError.noSupport();
}
} | java |
@Override
public void setTypeMap(Map<String,Class<?>> map) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java |
@Override
public void saveStatistics(ClientStats stats, String file) throws IOException
{
this.NativeConnection.saveStatistics(stats, file);
} | java |
private static boolean trimProcQuotas(ZooKeeper zk, String path)
throws KeeperException, IOException, InterruptedException {
if (Quotas.quotaZookeeper.equals(path)) {
return true;
}
List<String> children = zk.getChildren(path, false);
if (children.size() == 0) {
... | java |
public static boolean delQuota(ZooKeeper zk, String path, boolean bytes,
boolean numNodes) throws KeeperException, IOException,
InterruptedException {
String parentPath = Quotas.quotaZookeeper + path;
String quotaPath = Quotas.quotaZookeeper + path + "/"
+ Quotas.... | java |
private static int generateCrudPKeyWhereClause(Column partitioncolumn,
Constraint pkey, StringBuilder sb)
{
// Sort the catalog index columns by index column order.
ArrayList<ColumnRef> indexColumns = new ArrayList<ColumnRef>(pkey.getIndex().getColumns().size());
for (ColumnRef c... | java |
private static void generateCrudExpressionColumns(Table table, StringBuilder sb) {
boolean first = true;
// Sort the catalog table columns by column order.
ArrayList<Column> tableColumns = new ArrayList<Column>(table.getColumns().size());
for (Column c : table.getColumns()) {
... | java |
public InProcessVoltDBServer start() {
DeploymentBuilder depBuilder = new DeploymentBuilder(sitesPerHost, 1, 0);
depBuilder.setEnableCommandLogging(false);
depBuilder.setUseDDLSchema(true);
depBuilder.setHTTPDPort(8080);
depBuilder.setJSONAPIEnabled(true);
VoltDB.Configu... | java |
public void compile(Session session) {
if (!database.schemaManager.schemaExists(compileTimeSchema.name)) {
compileTimeSchema = session.getSchemaHsqlName(null);
}
session.setSchema(compileTimeSchema.name);
ParserDQL p = new ParserDQL(session, new Scanner(statement));
... | java |
public static Pair<InMemoryJarfile, String> loadAndUpgradeCatalogFromJar(byte[] catalogBytes, boolean isXDCR)
throws IOException
{
// Throws IOException on load failure.
InMemoryJarfile jarfile = loadInMemoryJarFile(catalogBytes);
return loadAndUpgradeCatalogFromJar(jarfile, isXDCR)... | java |
public static Pair<InMemoryJarfile, String> loadAndUpgradeCatalogFromJar(InMemoryJarfile jarfile, boolean isXDCR)
throws IOException
{
// Let VoltCompiler do a version check and upgrade the catalog on the fly.
// I.e. jarfile may be modified.
VoltCompiler compiler = new VoltCompiler(... | java |
public static String getSerializedCatalogStringFromJar(InMemoryJarfile jarfile)
{
byte[] serializedCatalogBytes = jarfile.get(CatalogUtil.CATALOG_FILENAME);
String serializedCatalog = new String(serializedCatalogBytes, Constants.UTF8ENCODING);
return serializedCatalog;
} | java |
public static String[] getBuildInfoFromJar(InMemoryJarfile jarfile)
throws IOException
{
// Read the raw build info bytes.
byte[] buildInfoBytes = jarfile.get(CATALOG_BUILDINFO_FILENAME);
if (buildInfoBytes == null) {
throw new IOException("Catalog build information n... | java |
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile)
throws IOException
{
// Read the raw auto generated ddl bytes.
byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME);
if (ddlBytes == null) {
throw new IOException("Auto generated schema DD... | java |
public static InMemoryJarfile getCatalogJarWithoutDefaultArtifacts(final InMemoryJarfile jarfile) {
InMemoryJarfile cloneJar = jarfile.deepCopy();
for (String entry : CATALOG_DEFAULT_ARTIFACTS) {
cloneJar.remove(entry);
}
return cloneJar;
} | java |
public static InMemoryJarfile loadInMemoryJarFile(byte[] catalogBytes)
throws IOException
{
assert(catalogBytes != null);
InMemoryJarfile jarfile = new InMemoryJarfile(catalogBytes);
if (!jarfile.containsKey(CATALOG_FILENAME)) {
throw new IOException("Database catalo... | java |
public static boolean isSnapshotablePersistentTableView(Database db, Table table) {
Table materializer = table.getMaterializer();
if (materializer == null) {
// Return false if it is not a materialized view.
return false;
}
if (CatalogUtil.isTableExportOnly(db, ma... | java |
public static boolean isSnapshotableStreamedTableView(Database db, Table table) {
Table materializer = table.getMaterializer();
if (materializer == null) {
// Return false if it is not a materialized view.
return false;
}
if (! CatalogUtil.isTableExportOnly(db, ma... | java |
public static long getUniqueIdForFragment(PlanFragment frag) {
long retval = 0;
CatalogType parent = frag.getParent();
retval = ((long) parent.getParent().getRelativeIndex()) << 32;
retval += ((long) parent.getRelativeIndex()) << 16;
retval += frag.getRelativeIndex();
re... | java |
public static <T extends CatalogType> List<T> getSortedCatalogItems(CatalogMap<T> items, String sortFieldName) {
assert(items != null);
assert(sortFieldName != null);
// build a treemap based on the field value
TreeMap<Object, T> map = new TreeMap<>();
boolean hasField = false;
... | java |
public static <T extends CatalogType> void getSortedCatalogItems(CatalogMap<T> items, String sortFieldName, List<T> result) {
result.addAll(getSortedCatalogItems(items, sortFieldName ));
} | java |
public static Index getPrimaryKeyIndex(Table catalogTable) throws Exception {
// We first need to find the pkey constraint
Constraint catalog_constraint = null;
for (Constraint c : catalogTable.getConstraints()) {
if (c.getType() == ConstraintType.PRIMARY_KEY.getValue()) {
... | java |
public static Collection<Column> getPrimaryKeyColumns(Table catalogTable) {
Collection<Column> columns = new ArrayList<>();
Index catalog_idx = null;
try {
catalog_idx = CatalogUtil.getPrimaryKeyIndex(catalogTable);
} catch (Exception ex) {
// IGNORE
r... | java |
public static boolean isTableExportOnly(org.voltdb.catalog.Database database,
org.voltdb.catalog.Table table) {
int type = table.getTabletype();
if (TableType.isInvalidType(type)) {
// This implementation uses connectors instead of just looking at ... | java |
public static boolean isTableMaterializeViewSource(org.voltdb.catalog.Database database,
org.voltdb.catalog.Table table)
{
CatalogMap<Table> tables = database.getTables();
for (Table t : tables) {
Table matsrc = t.getMaterializer();
... | java |
public static List<Table> getMaterializeViews(org.voltdb.catalog.Database database,
org.voltdb.catalog.Table table)
{
ArrayList<Table> tlist = new ArrayList<>();
CatalogMap<Table> tables = database.getTables();
for (Table t : tables) {
... | java |
public static boolean isCatalogCompatible(String catalogVersionStr)
{
if (catalogVersionStr == null || catalogVersionStr.isEmpty()) {
return false;
}
//Check that it is a properly formed verstion string
Object[] catalogVersion = MiscUtils.parseVersionString(catalogVersio... | java |
public static boolean isCatalogVersionValid(String catalogVersionStr)
{
// Do we have a version string?
if (catalogVersionStr == null || catalogVersionStr.isEmpty()) {
return false;
}
//Check that it is a properly formed version string
Object[] catalogVersion = M... | java |
public static String compileDeployment(Catalog catalog,
DeploymentType deployment,
boolean isPlaceHolderCatalog)
{
String errmsg = null;
try {
validateDeployment(catalog, deployment);
// add our hacky Deployment to the catalog
if (catalog... | java |
public static DeploymentType parseDeployment(String deploymentURL) {
// get the URL/path for the deployment and prep an InputStream
InputStream deployIS = null;
try {
URL deployURL = new URL(deploymentURL);
deployIS = deployURL.openStream();
} catch (MalformedURLE... | java |
public static DeploymentType parseDeploymentFromString(String deploymentString) {
ByteArrayInputStream byteIS;
byteIS = new ByteArrayInputStream(deploymentString.getBytes(Constants.UTF8ENCODING));
// get deployment info from xml file
return getDeployment(byteIS);
} | java |
public static String getDeployment(DeploymentType deployment, boolean indent) throws IOException {
try {
if (m_jc == null || m_schema == null) {
throw new RuntimeException("Error schema validation.");
}
Marshaller marshaller = m_jc.createMarshaller();
... | java |
private static void validateDeployment(Catalog catalog, DeploymentType deployment) {
if (deployment.getSecurity() != null && deployment.getSecurity().isEnabled()) {
if (deployment.getUsers() == null) {
String msg = "Cannot enable security without defining at least one user in the bui... | java |
private static void setClusterInfo(Catalog catalog, DeploymentType deployment) {
ClusterType cluster = deployment.getCluster();
int kFactor = cluster.getKfactor();
Cluster catCluster = catalog.getClusters().get("cluster");
// copy the deployment info that is currently not recorded anywh... | java |
private static void setImportInfo(Catalog catalog, ImportType importType) {
if (importType == null) {
return;
}
List<String> streamList = new ArrayList<>();
List<ImportConfigurationType> kafkaConfigs = new ArrayList<>();
for (ImportConfigurationType importConfigurati... | java |
private static void validateKafkaConfig(List<ImportConfigurationType> configs) {
if (configs.isEmpty()) {
return;
}
// We associate each group id with the set of topics that belong to it
HashMap<String, HashSet<String>> groupidToTopics = new HashMap<>();
for (ImportCo... | java |
private static void setSnmpInfo(SnmpType snmpType) {
if (snmpType == null || !snmpType.isEnabled()) {
return;
}
//Validate Snmp Configuration.
if (snmpType.getTarget() == null || snmpType.getTarget().trim().length() == 0) {
throw new IllegalArgumentException("Targ... | java |
private static void mergeKafka10ImportConfigurations(Map<String, ImportConfiguration> processorConfig) {
if (processorConfig.isEmpty()) {
return;
}
Map<String, ImportConfiguration> kafka10ProcessorConfigs = new HashMap<>();
Iterator<Map.Entry<String, ImportConfiguration>> it... | java |
private static void setSecurityEnabled( Catalog catalog, SecurityType security) {
Cluster cluster = catalog.getClusters().get("cluster");
Database database = cluster.getDatabases().get("database");
cluster.setSecurityenabled(security.isEnabled());
database.setSecurityprovider(security.g... | java |
private static void setSnapshotInfo(Catalog catalog, SnapshotType snapshotSettings) {
Database db = catalog.getClusters().get("cluster").getDatabases().get("database");
SnapshotSchedule schedule = db.getSnapshotschedule().get("default");
if (schedule == null) {
schedule = db.getSnaps... | java |
private static void setupPaths( PathsType paths) {
File voltDbRoot;
// Handles default voltdbroot (and completely missing "paths" element).
voltDbRoot = getVoltDbRoot(paths);
//Snapshot
setupSnapshotPaths(paths.getSnapshots(), voltDbRoot);
//export overflow
setupE... | java |
public static File getVoltDbRoot(PathsType paths) {
File voltDbRoot;
if (paths == null || paths.getVoltdbroot() == null || VoltDB.instance().getVoltDBRootPath(paths.getVoltdbroot()) == null) {
voltDbRoot = new VoltFile(VoltDB.DBROOT);
if (!voltDbRoot.exists()) {
h... | java |
private static void setUsersInfo(Catalog catalog, UsersType users) throws RuntimeException {
if (users == null) {
return;
}
// The database name is not available in deployment.xml (it is defined
// in project.xml). However, it must always be named "database", so
// I... | java |
private static Set<String> extractUserRoles(final UsersType.User user) {
Set<String> roles = new TreeSet<>();
if (user == null) {
return roles;
}
if (user.getRoles() != null && !user.getRoles().trim().isEmpty()) {
String [] rolelist = user.getRoles().trim().split... | java |
public static byte[] makeDeploymentHash(byte[] inbytes)
{
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
VoltDB.crashLocalVoltDB("Bad JVM has no SHA-1 hash.", true, e);
}
md.update(inbytes... | java |
public static Pair<Set<String>, Set<String>>
getSnapshotableTableNamesFromInMemoryJar(InMemoryJarfile jarfile) {
Set<String> fullTableNames = new HashSet<>();
Set<String> optionalTableNames = new HashSet<>();
Catalog catalog = new Catalog();
catalog.execute(getSerializedCatalogString... | java |
public static Pair<List<Table>, Set<String>>
getSnapshotableTables(Database catalog, boolean isReplicated) {
List<Table> tables = new ArrayList<>();
Set<String> optionalTableNames = new HashSet<>();
for (Table table : catalog.getTables()) {
if (table.getIsreplicated() != isReplic... | java |
public static List<Table> getNormalTables(Database catalog, boolean isReplicated) {
List<Table> tables = new ArrayList<>();
for (Table table : catalog.getTables()) {
if ((table.getIsreplicated() == isReplicated) &&
table.getMaterializer() == null &&
!C... | java |
public static boolean isDurableProc(String procName) {
SystemProcedureCatalog.Config sysProc = SystemProcedureCatalog.listing.get(procName);
return sysProc == null || sysProc.isDurable();
} | java |
public static File createTemporaryEmptyCatalogJarFile(boolean isXDCR) throws IOException {
File emptyJarFile = File.createTempFile("catalog-empty", ".jar");
emptyJarFile.deleteOnExit();
VoltCompiler compiler = new VoltCompiler(isXDCR);
if (!compiler.compileEmptyCatalog(emptyJarFile.getAb... | java |
public static String getSignatureForTable(String name, SortedMap<Integer, VoltType> schema) {
StringBuilder sb = new StringBuilder();
sb.append(name).append(SIGNATURE_TABLE_NAME_SEPARATOR);
for (VoltType t : schema.values()) {
sb.append(t.getSignatureChar());
}
return... | java |
public static Pair<Long, String> calculateDrTableSignatureAndCrc(Database catalog) {
SortedSet<Table> tables = Sets.newTreeSet();
tables.addAll(getSnapshotableTables(catalog, true).getFirst());
tables.addAll(getSnapshotableTables(catalog, false).getFirst());
final PureJavaCrc32 crc = ne... | java |
public static Map<String, String> deserializeCatalogSignature(String signature) {
Map<String, String> tableSignatures = Maps.newHashMap();
for (String oneSig : signature.split(Pattern.quote(SIGNATURE_DELIMITER))) {
if (!oneSig.isEmpty()) {
final String[] parts = oneSig.split(... | java |
public static String getLimitPartitionRowsDeleteStmt(Table table) {
CatalogMap<Statement> map = table.getTuplelimitdeletestmt();
if (map.isEmpty()) {
return null;
}
assert (map.size() == 1);
return map.iterator().next().getSqltext();
} | java |
public static ExportType addExportConfigToDRConflictsTable(ExportType export) {
if (export == null) {
export = new ExportType();
}
boolean userDefineStream = false;
for (ExportConfigurationType exportConfiguration : export.getConfiguration()) {
if (exportConfigura... | java |
public synchronized void printResults() throws Exception {
ClientStats stats = fullStatsContext.fetch().getStats();
String display = "\nA total of %d login requests were received...\n";
System.out.printf(display, stats.getInvocationsCompleted());
System.out.printf("Average throughput: ... | java |
private void doLogin(LoginGenerator.LoginRecord login) {
// Synchronously call the "Login" procedure passing in a json string containing
// login-specific structure/data.
try {
ClientResponse response = client.callProcedure("Login",
... | java |
public void loadDatabase() throws Exception {
// create/start the requested number of threads
int thread_count = 10;
Thread[] loginThreads = new Thread[thread_count];
for (int i = 0; i < thread_count; ++i) {
loginThreads[i] = new Thread(new LoginThread());
loginTh... | java |
public static void main(String[] args) throws Exception {
JSONClient app = new JSONClient();
// Initialize connections
app.initialize();
// load data, measuring the throughput.
app.loadDatabase();
// run sample JSON queries
app.runQueries();
// Disconn... | java |
@Override
public synchronized void reportForeignHostFailed(int hostId) {
long initiatorSiteId = CoreUtils.getHSIdFromHostAndSite(hostId, AGREEMENT_SITE_ID);
m_agreementSite.reportFault(initiatorSiteId);
if (!m_shuttingDown) {
// should be the single console message a user sees wh... | java |
public void start() throws Exception {
/*
* SJ uses this barrier if this node becomes the leader to know when ZooKeeper
* has been finished bootstrapping.
*/
CountDownLatch zkInitBarrier = new CountDownLatch(1);
/*
* If start returns true then this node is th... | java |
public InstanceId getInstanceId()
{
if (m_instanceId == null)
{
try
{
byte[] data =
m_zk.getData(CoreZK.instance_id, false, null);
JSONObject idJSON = new JSONObject(new String(data, "UTF-8"));
m_instanceId =... | java |
@Override
public void requestJoin(SocketChannel socket, SSLEngine sslEngine,
MessagingChannel messagingChannel,
InetSocketAddress listeningAddress, JSONObject jo) throws Exception {
/*
* Generate the host id via creating an ephemeral sequentia... | java |
@Override
public void notifyOfConnection(
int hostId,
SocketChannel socket,
SSLEngine sslEngine,
InetSocketAddress listeningAddress) throws Exception
{
networkLog.info("Host " + getHostId() + " receives a new connection from host " + hostId);
prepS... | java |
public Map<Integer, HostInfo> waitForGroupJoin(int expectedHosts) {
Map<Integer, HostInfo> hostInfos = Maps.newTreeMap();
try {
while (true) {
ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher();
final List<String> children = m_zk.getChildren(CoreZK.hosts, f... | java |
@Override
public String getHostnameForHostID(int hostId) {
if (hostId == m_localHostId) {
return CoreUtils.getHostnameOrAddress();
}
Iterator<ForeignHost> it = m_foreignHosts.get(hostId).iterator();
if (it.hasNext()) {
ForeignHost fh = it.next();
r... | java |
public void removeMailbox(long hsId) {
synchronized (m_mapLock) {
ImmutableMap.Builder<Long, Mailbox> b = ImmutableMap.builder();
for (Map.Entry<Long, Mailbox> e : m_siteMailboxes.entrySet()) {
if (e.getKey().equals(hsId)) {
continue;
}... | java |
public void waitForAllHostsToBeReady(int expectedHosts) {
try {
m_zk.create(CoreZK.readyhosts_host, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
while (true) {
ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher();
int readyHosts = m_zk.getC... | java |
public void waitForJoiningHostsToBeReady(int expectedHosts, int localHostId) {
try {
//register this host as joining. The host registration will be deleted after joining is completed.
m_zk.create(ZKUtil.joinZKPath(CoreZK.readyjoininghosts, Integer.toString(localHostId)) , null, Ids.OPEN_... | java |
public int countForeignHosts() {
int retval = 0;
for (ForeignHost host : m_foreignHosts.values()) {
if ((host != null) && (host.isUp())) {
retval++;
}
}
return retval;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.