code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private void copyObjectIDsToBatch(BatchResult batchResult, DBObjectBatch dbObjBatch) {
if (batchResult.getResultObjectCount() < dbObjBatch.getObjectCount()) {
m_logger.warn("Batch result returned fewer objects ({}) than input batch ({})",
batchResult.getResultObjectCount... | java |
private void verifyApplication() {
String ss = m_appDef.getStorageService();
if (Utils.isEmpty(ss) || !ss.startsWith("Spider")) {
throw new RuntimeException("Application '" + m_appDef.getAppName() +
"' is not an Spider application");
}
... | java |
double getVersionNumber() {
if(cassandraVersion > 0) {
return cassandraVersion;
}
String version = getReleaseVersion();
if (version == null) {
throw new IllegalStateException("Can't get Cassandra release version.");
}
String[] toks = version.split("\\.");
if (toks.length >= 3) {... | java |
private Map<File, File[]> getDataMap_1_1(String[] dataDirs) {
Map<File, File[]> map = new HashMap<File, File[]>();
boolean doLog = false;
if(!lockedMessages.contains("getDataMap")) {
lockedMessages.add("getDataMap");
doLog = true;
}
for (int i = 0; i < dataDirs.length; i++) {
File dir = n... | java |
private Map<File, File> getDataMap(int vcode, String[] dataDirs, String snapshotName) {
Map<File, File> map = new HashMap<File, File>();
Map<File, File[]> src = vcode==0 ? getDataMap_1_0(dataDirs) : getDataMap_1_1(dataDirs);
for (File ks : src.keySet()) {
File[] sn = src.get(ks);
if (sn != null) {
... | java |
private void run(String[] args) {
if (args.length != 2) {
usage();
}
System.out.println("Opening Doradus server: " + args[0] + ":" + args[1]);
try (DoradusClient client = new DoradusClient(args[0], Integer.parseInt(args[1]))) {
deleteApplication(cl... | java |
private void deleteApplication(DoradusClient client) {
Command command = Command.builder()
.withName("DeleteAppWithKey")
.withParam("application", "HelloSpider")
.withParam("key", "Arachnid")
.build();
client.runCommand(command); // Ignore response
... | java |
private void createApplication(DoradusClient client) {
ApplicationDefinition appDef = ApplicationDefinition.builder()
.withName("HelloSpider")
.withKey("Arachnid")
.withOption("StorageService", "SpiderService")
.withTable(TableDefinition.builder()
... | java |
private void deleteData(DoradusClient client) {
DBObject dbObject = DBObject.builder()
.withValue("_ID", "TMaguire")
.build();
DBObjectBatch dbObjectBatch = DBObjectBatch.builder().withObject(dbObject).build();
Command command = Command.builder().withName("Delet... | java |
private void loadSchema() {
m_logger.info("Loading schema for application: {}", m_config.app);
m_client = new Client(m_config.host, m_config.port, m_config.getTLSParams());
m_client.setCredentials(m_config.getCredentials());
m_session = m_client.openApplication(m_config.app); // thro... | java |
private void computeLinkFanouts(TableDefinition tableDef,
Map<String, MutableFloat> tableLinkFanoutMap) {
m_logger.info("Computing link field fanouts for table: {}", tableDef.getTableName());
StringBuilder buffer = new StringBuilder();
for (Field... | java |
private void start(long time, String name){
name = getName(name);
TimerGroupItem timer = m_timers.get(name);
if (timer == null){
timer = new TimerGroupItem(name);
m_timers.put(name, timer);
}
timer.start(time);
m_total.start(time);
} | java |
private long stop(long time, String name){
m_total.stop(time);
TimerGroupItem timer = m_timers.get(getName(name));
long elapsedTime = 0;
if (timer != null){
elapsedTime = timer.stop(time);
}
checkLog(time);
return elapsedTime;
} | java |
private void log(boolean finalLog, String format, Object... args) {
if (m_condition){
if (format != null ){
m_logger.debug(String.format(format, args));
}
ArrayList<String> timerNames = new ArrayList<String>(m_timers.keySet());
Collections.sort(timerNames);
for (String name : timerNames){
... | java |
public void parse(UNode rootNode) {
assert rootNode != null;
// Ensure root node is named "batch".
Utils.require(rootNode.getName().equals("batch"),
"'batch' expected: " + rootNode.getName());
// Parse child nodes.
for (String memberName : ... | java |
public UNode toDoc() {
// Root object is a MAP called "batch".
UNode batchNode = UNode.createMapNode("batch");
// Add a "docs" node as an array.
UNode docsNode = batchNode.addArrayNode("docs");
for (DBObject dbObj : m_dbObjList) {
docsNode.addChildNode... | java |
public DBObject addObject(String objID, String tableName) {
DBObject dbObj = new DBObject(objID, tableName);
m_dbObjList.add(dbObj);
return dbObj;
} | java |
private Server configureJettyServer() {
LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>(m_maxTaskQueue);
QueuedThreadPool threadPool = new QueuedThreadPool(m_maxconns, m_defaultMinThreads, m_defaultIdleTimeout,
taskQueue);
Server server = new Server(thread... | java |
private ServerConnector configureConnector() {
ServerConnector connector = null;
if (m_tls) {
connector = createSSLConnector();
} else {
// Unsecured connector
connector = new ServerConnector(m_jettyServer);
}
if (m_restaddr != null) {
... | java |
private ServletHandler configureHandler(String servletClassName) {
ServletHandler handler = new ServletHandler();
handler.addServletWithMapping(servletClassName, "/*");
return handler;
} | java |
@Override
public final void run() {
String taskID = m_taskRecord.getTaskID();
m_logger.debug("Starting task '{}' in tenant '{}'", taskID, m_tenant);
try {
TaskManagerService.instance().registerTaskStarted(this);
m_lastProgressTimestamp = System.currentTimeMillis();
... | java |
private void setTaskStart() {
m_taskRecord.setProperty(TaskRecord.PROP_EXECUTOR, m_hostID);
m_taskRecord.setProperty(TaskRecord.PROP_START_TIME, Long.toString(System.currentTimeMillis()));
m_taskRecord.setProperty(TaskRecord.PROP_FINISH_TIME, null);
m_taskRecord.setProperty(TaskRecord.PR... | java |
private void setTaskFailed(String reason) {
m_taskRecord.setProperty(TaskRecord.PROP_EXECUTOR, m_hostID);
m_taskRecord.setProperty(TaskRecord.PROP_FINISH_TIME, Long.toString(System.currentTimeMillis()));
m_taskRecord.setProperty(TaskRecord.PROP_FAIL_REASON, reason);
m_taskRecord.setStatu... | java |
private void reconnect() throws IOException {
// First ensure we're closed.
close();
// Attempt to re-open.
try {
createSocket();
} catch (Exception e) {
e.printStackTrace();
throw new IOException("Cannot connect to server", e);
}
m_inStream = m_s... | java |
private RESTResponse sendAndReceive(HttpMethod method,
String uri,
Map<String, String> headers,
byte[] body) throws IOException {
// Add standard headers... | java |
private RESTResponse sendAndReceive(String header, byte[] body) throws IOException {
// Fail before trying if socket has been closed.
if (isClosed()) {
throw new IOException("Socket has been closed");
}
Exception lastException = null;
for (int attempt ... | java |
private void sendRequest(String header, byte[] body) throws IOException {
// Send entire message in one write, else suffer the fate of weird TCP/IP stacks.
byte[] headerBytes = Utils.toBytes(header);
byte[] requestBytes = headerBytes;
if (body != null && body.length > 0) {
... | java |
private RESTResponse readResponse() throws IOException {
// Read response code from the header line.
HttpCode resultCode = readStatusLine();
// Read and save headers, keeping track of content-length if we find it.
Map<String, String> headers = new HashMap<String, String>();... | java |
private HttpCode readStatusLine() throws IOException {
// Read a line of text, which should be in the format HTTP/<version <code> <reason>
String statusLine = readHeader();
String[] parts = statusLine.split(" +");
if (parts.length < 3) {
throw new IOException("Badly form... | java |
private void createSocket() throws Exception {
// Some socket options, notably setReceiveBufferSize, must be set before the
// socket is connected. So, first create the socket, then set options, then connect.
if (m_sslParams != null) {
SSLSocketFactory factory = m_sslParams.creat... | java |
private void setSocketOptions() throws SocketException {
if (DISABLE_NAGLES) {
// Disable Nagle's algorithm (significant on Windows).
m_socket.setTcpNoDelay(true);
m_logger.debug("Nagle's algorithm disabled.");
}
if (USE_CUSTOM_BUFFER_SIZE) {
... | java |
public void set(int[] indexes, int[] offsets, int[] lengths) {
m_size = indexes.length;
m_valuesCount = offsets.length;
m_offsets = offsets;
m_lengths = lengths;
m_prefixes = new int[offsets.length];
m_suffixes = new int[offsets.length];
m_indexes = indexes;
} | java |
@SuppressWarnings("unchecked")
private String keyspaceDefaultsToCQLString() {
// Default defaults:
boolean durable_writes = true;
Map<String, Object> replication = new HashMap<String, Object>();
replication.put("class", "SimpleStrategy");
replication.put("replication_factor",... | java |
private static String mapToCQLString(Map<String, Object> valueMap) {
StringBuffer buffer = new StringBuffer();
buffer.append("{");
boolean bFirst = true;
for (String name : valueMap.keySet()) {
if (bFirst) {
bFirst = false;
} else {
... | java |
private ResultSet executeCQL(String cql) {
m_logger.debug("Executing CQL: {}", cql);
try {
return m_dbservice.getSession().execute(cql);
} catch (Exception e) {
m_logger.error("CQL query failed", e);
m_logger.info(" Query={}", cql);
throw e;
... | java |
private void checkTable() {
// Documentation says that "0 xxx" means data-aging is disabled.
if (m_retentionAge.getValue() == 0) {
m_logger.info("Data aging disabled for table: {}", m_tableDef.getTableName());
return;
}
m_logger.info("Checking expired obj... | java |
private String buildFixedQuery(GregorianCalendar expireDate) {
// Query: '{aging field} <= "{expire date}"', fetching the _ID and
// aging field, up to a batch full at a time.
StringBuilder fixedParams = new StringBuilder();
fixedParams.append("q=");
fixedParams.append(m_agingFie... | java |
private boolean deleteBatch(List<String> objIDs) {
if (objIDs.size() == 0) {
return false;
}
m_logger.debug("Deleting batch of {} objects from {}", objIDs.size(), m_tableDef.getTableName());
BatchObjectUpdater batchUpdater = new BatchObjectUpdater(m_tableDef);
BatchRe... | java |
public void commit(DBTransaction transaction) {
try {
applyUpdates(transaction);
} catch (Exception e) {
m_logger.error("Updates failed", e);
throw e;
} finally {
transaction.clear();
}
} | java |
private void applyUpdates(DBTransaction transaction) {
if (transaction.getMutationsCount() == 0) {
m_logger.debug("Skipping commit with no updates");
} else if (m_dbservice.getParamBoolean("async_updates")) {
executeUpdatesAsynchronous(transaction);
} else {
e... | java |
private void executeUpdatesAsynchronous(DBTransaction transaction) {
Collection<BoundStatement> mutations = getMutations(transaction);
List<ResultSetFuture> futureList = new ArrayList<>(mutations.size());
for(BoundStatement mutation: mutations) {
ResultSetFuture future = m_dbservice.... | java |
private void executeUpdatesSynchronous(DBTransaction transaction) {
BatchStatement batchState = new BatchStatement(Type.UNLOGGED);
batchState.addAll(getMutations(transaction));
executeBatch(batchState);
} | java |
private BoundStatement addColumnUpdate(String tableName, String key, DColumn column, boolean isBinaryValue) {
PreparedStatement prepState = m_dbservice.getPreparedUpdate(Update.INSERT_ROW, tableName);
BoundStatement boundState = prepState.bind();
boundState.setString(0, key);
boundState.... | java |
private BoundStatement addColumnDelete(String tableName, String key, String colName) {
PreparedStatement prepState = m_dbservice.getPreparedUpdate(Update.DELETE_COLUMN, tableName);
BoundStatement boundState = prepState.bind();
boundState.setString(0, key);
boundState.setString(1, colName... | java |
private BoundStatement addRowDelete(String tableName, String key) {
PreparedStatement prepState = m_dbservice.getPreparedUpdate(Update.DELETE_ROW, tableName);
BoundStatement boundState = prepState.bind();
boundState.setString(0, key);
return boundState;
} | java |
private void executeBatch(BatchStatement batchState) {
if (batchState.size() > 0) {
m_logger.debug("Executing synchronous batch with {} statements", batchState.size());
m_dbservice.getSession().execute(batchState);
}
} | java |
public synchronized void onRequestRejected(String reason) {
allRequestsTracker.onRequestRejected(reason);
recentRequestsTracker.onRequestRejected(reason);
meter.mark();
} | java |
public boolean deleteShard(String shard) {
Utils.require(!Utils.isEmpty(shard), "shard");
try {
// Send a DELETE request to "/{application}/_shards/{shard}"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix... | java |
public Collection<String> getShardNames() {
List<String> shardNames = new ArrayList<>();
try {
// Send a GET request to "/{application}/_shards"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix()); ... | java |
public UNode getShardStats(String shardName) {
try {
// Send a GET request to "/{application}/_shards/{shard}"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("... | java |
public boolean mergeShard(String shard, Date expireDate) {
Utils.require(!Utils.isEmpty(shard), "shard");
try {
// Send a POST request to "/{application}/_shards/{shard}[?expire-date=<date>]"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "... | java |
public static boolean allAlphaNumUnderscore(String string) {
if (string == null || string.length() == 0) {
return false;
}
for (int index = 0; index < string.length(); index++) {
char ch = string.charAt(index);
if (!isLetter(ch) && !isDigit(ch) && ch != ... | java |
public static String base64ToHex(String base64Value) throws IllegalArgumentException {
byte[] binary = base64ToBinary(base64Value);
return DatatypeConverter.printHexBinary(binary);
} | java |
public static String base64FromHex(String hexValue) throws IllegalArgumentException {
byte[] binary = DatatypeConverter.parseHexBinary(hexValue);
return base64FromBinary(binary);
} | java |
public static String base64ToString(String base64Value) {
Utils.require(base64Value.length() % 4 == 0,
"Invalid base64 value (must be a multiple of 4 chars): " + base64Value);
byte[] utf8String = DatatypeConverter.parseBase64Binary(base64Value);
return toString(utf8Stri... | java |
public static long getTimeMicros() {
// Use use a dedicated lock object rather than synchronizing on the method, which
// would synchronize on the Utils.class object, which is too coarse-grained.
synchronized (g_lastMicroLock) {
// We use System.currentTimeMillis() * 1000 for com... | java |
public static String deWhite(byte[] value) {
// If the value contains anything less than a space.
StringBuilder buffer = new StringBuilder();
boolean bAllPrintable = true;
for (byte b : value) {
if ((int)(b & 0xFF) < ' ') {
bAllPrintable = false;
... | java |
public static boolean getBooleanValue(String value) throws IllegalArgumentException {
require("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value),
"'true' or 'false' expected: " + value);
return "true".equalsIgnoreCase(value);
} | java |
public static String getElementText(Element elem) {
StringBuilder result = new StringBuilder();
NodeList nodeList = elem.getChildNodes();
for (int index = 0; index < nodeList.getLength(); index++) {
Node childNode = nodeList.item(index);
if (childNode != null && (chi... | java |
public static String md5Encode(String strIn) {
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
byte[] bin = toBytes(strIn);
byte[] bout = md5.digest(bin);
String strOut = javax.xml.bind.DatatypeConverter.printBase64Binary(bout);
retur... | java |
public static Element parseXMLDocument(String xmlDoc) throws IllegalArgumentException {
// Parse the given XML document returning its root document Element if it parses.
// Wrap the document payload as an InputSource.
Reader stringReader = new StringReader(xmlDoc);
InputSource inputS... | java |
public static void requireEmptyText(Node node, String errMsg)
throws IllegalArgumentException {
require((node instanceof Text) || (node instanceof Comment),
errMsg + ": " + node.toString());
if (node instanceof Text) {
Text text = (Text)node;
Str... | java |
private static byte[] toAsciiBytes(String str) {
for(int i = 0; i < str.length(); i++) {
if(str.charAt(i) > 127) return null;
}
byte[] bytes = new byte[str.length()];
for(int i = 0; i < str.length(); i++) {
bytes[i] = (byte)str.charAt(i);
}
... | java |
private static String toAsciiString(byte[] bytes) {
for(int i = 0; i < bytes.length; i++) {
if(bytes[i] < 0) return null;
}
char[] chars = new char[bytes.length];
for(int i = 0; i < bytes.length; i++) {
chars[i] = (char)bytes[i];
}
return n... | java |
public static GregorianCalendar truncateToWeek(GregorianCalendar date) {
// Round the date down to the MONDAY of the same week.
GregorianCalendar result = (GregorianCalendar)date.clone();
switch (result.get(Calendar.DAY_OF_WEEK)) {
case Calendar.TUESDAY: result.add(Calendar.DAY... | java |
private RESTResponse validateAndExecuteRequest(HttpServletRequest request) {
Map<String, String> variableMap = new HashMap<String, String>();
String query = extractQueryParam(request, variableMap);
Tenant tenant = getTenant(variableMap);
// Command matching expects an encoded URI b... | java |
private ApplicationDefinition getApplication(String uri, Tenant tenant) {
if (uri.length() < 2 || uri.startsWith("/_")) {
return null; // Non-application request
}
String[] pathNodes = uri.substring(1).split("/");
String appName = Utils.urlDecode(pathNodes[0]);
... | java |
private Tenant getTenant(Map<String, String> variableMap) {
String tenantName = variableMap.get("tenant");
if (Utils.isEmpty(tenantName)) {
tenantName = TenantService.instance().getDefaultTenantName();
}
Tenant tenant = TenantService.instance().getTenant(tenantName);
... | java |
private void validateTenantAccess(HttpServletRequest request, Tenant tenant, RegisteredCommand cmdModel) {
String authString = request.getHeader("Authorization");
StringBuilder userID = new StringBuilder();
StringBuilder password = new StringBuilder();
decodeAuthorizationHeader(authS... | java |
private Permission permissionForMethod(String method) {
switch (method.toUpperCase()) {
case "GET":
return Permission.READ;
case "PUT":
case "DELETE":
return Permission.UPDATE;
case "POST":
return Permission.APPEND;
default:
... | java |
private String extractQueryParam(HttpServletRequest request, Map<String, String> restParams) {
String query = request.getQueryString();
if (Utils.isEmpty(query)) {
return "";
}
StringBuilder buffer = new StringBuilder(query);
// Split query component i... | java |
private String getFullURI(HttpServletRequest request) {
StringBuilder buffer = new StringBuilder(request.getMethod());
buffer.append(" ");
buffer.append(request.getRequestURI());
String queryParam = request.getQueryString();
if (!Utils.isEmpty(queryParam)) {
buf... | java |
private static void setLegacy(String moduleName, String legacyParamName) {
String oldValue = g_legacyToModuleMap.put(legacyParamName, moduleName);
if (oldValue != null) {
logger.warn("Legacy parameter name used twice: {}", legacyParamName);
}
} | java |
private static void setLegacy(String moduleName, String... legacyParamNames) {
for (String legacyParamName : legacyParamNames) {
setLegacy(moduleName, legacyParamName);
}
} | java |
private static URL getConfigUrl() throws ConfigurationException {
String spec = System.getProperty(CONFIG_URL_PROPERTY_NAME);
if (spec == null) {
spec = DEFAULT_CONFIG_URL;
}
URL configUrl = null;
try {
configUrl = new URL(spec);
conf... | java |
@SuppressWarnings("unchecked")
private void updateMap(Map<String, Object> parentMap, String paramName, Object paramValue) {
Object currentValue = parentMap.get(paramName);
if (currentValue == null || !(currentValue instanceof Map)) {
if (paramValue instanceof Map) {
... | java |
private void setLegacyParam(String legacyParamName, Object paramValue) {
if (!m_bWarnedLegacyParam) {
logger.warn("Parameter '{}': Legacy parameter format is being phased-out. " +
"Please use new module/parameter format.", legacyParamName);
m_bWarnedLegacyPara... | java |
public void parse(UNode tableNode) {
assert tableNode != null;
// Verify table name and save it.
setTableName(tableNode.getName());
// Examine table node's children.
for (String childName : tableNode.getMemberNames()) {
UNode childNode = tabl... | java |
public static boolean isValidTableName(String tableName) {
return tableName != null &&
tableName.length() > 0 &&
Utils.isLetter(tableName.charAt(0)) &&
Utils.allAlphaNumUnderscore(tableName);
} | java |
public Date computeShardStart(int shardNumber) {
assert isSharded();
assert shardNumber > 0;
assert m_shardingStartDate != null;
// Shard #1 always starts on the sharding-start date.
Date result = null;
if (shardNumber == 1) {
result = m_shard... | java |
public int computeShardNumber(Date shardingFieldValue) {
assert shardingFieldValue != null;
assert isSharded();
assert m_shardingStartDate != null;
// Convert the sharding field value into a calendar object. Note that this value
// will have non-zero time elements.... | java |
public boolean isCollection(String fieldName) {
FieldDefinition fieldDef = m_fieldDefMap.get(fieldName);
return fieldDef != null && fieldDef.isScalarField() && fieldDef.isCollection();
} | java |
public boolean isLinkField(String fieldName) {
FieldDefinition fieldDef = m_fieldDefMap.get(fieldName);
return fieldDef != null && fieldDef.isLinkField();
} | java |
public void setOption(String optionName, String optionValue) {
// Ensure option value is not empty and trim excess whitespace.
Utils.require(optionName != null, "optionName");
Utils.require(optionValue != null && optionValue.trim().length() > 0,
"Value for option '" + o... | java |
public TableDefinition getLinkExtentTableDef(FieldDefinition linkDef) {
assert linkDef != null;
assert linkDef.isLinkType();
assert m_appDef != null;
TableDefinition tableDef = m_appDef.getTableDef(linkDef.getLinkExtent());
assert tableDef != null;
return ... | java |
public boolean extractLinkValue(String colName, Map<String, Set<String>> mvLinkValueMap) {
// Link column names always begin with '~'.
if (colName.length() == 0 || colName.charAt(0) != '~') {
return false;
}
// A '/' should separate the field name and object va... | java |
private void addAliasDefinition(AliasDefinition aliasDef) {
// Prerequisites:
assert aliasDef != null;
assert !m_aliasDefMap.containsKey(aliasDef.getName());
assert aliasDef.getTableName().equals(this.getTableName());
m_aliasDefMap.put(aliasDef.getName(), aliasDef)... | java |
private void verifyJunctionField(FieldDefinition xlinkDef) {
String juncField = xlinkDef.getXLinkJunction();
if (!"_ID".equals(juncField)) {
FieldDefinition juncFieldDef = m_fieldDefMap.get(juncField);
Utils.require(juncFieldDef != null,
String.form... | java |
private AttributeValue mapColumnValue(String storeName, DColumn col) {
AttributeValue attrValue = new AttributeValue();
if (!DBService.isSystemTable(storeName)) {
if (col.getRawValue().length == 0) {
attrValue.setS(DynamoDBService.NULL_COLUMN_MARKER);
} else {
... | java |
public Set<String> extractTerms(String value) {
try {
Set<String> result = new HashSet<String>();
Set<String> split = Utils.split(value.toLowerCase(), CommonDefs.MV_SCALAR_SEP_CHAR);
for(String s : split) {
String[] tokens = tokenize(s);
for (String token : tokens) {
... | java |
public static BatchResult newErrorResult(String errMsg) {
BatchResult result = new BatchResult();
result.setStatus(Status.ERROR);
result.setErrorMessage(errMsg);
return result;
} | java |
public boolean hasUpdates() {
String hasUpdates = m_resultFields.get(HAS_UPDATES);
return hasUpdates != null && Boolean.parseBoolean(hasUpdates);
} | java |
public UNode toDoc() {
// Root node is map with 1 child per result field and optionally "docs".
UNode result = UNode.createMapNode("batch-result");
for (String fieldName : m_resultFields.keySet()) {
result.addValueNode(fieldName, m_resultFields.get(fieldName));
}
... | java |
void registerTaskStarted(Task task) {
synchronized (m_activeTasks) {
String mapKey = createMapKey(task.getTenant(), task.getTaskID());
if (m_activeTasks.put(mapKey, task) != null) {
m_logger.warn("Task {} registered as started but was already running", mapKey);
... | java |
void registerTaskEnded(Task task) {
synchronized (m_activeTasks) {
String mapKey = createMapKey(task.getTenant(), task.getTaskID());
if (m_activeTasks.remove(mapKey) == null) {
m_logger.warn("Task {} registered as ended but was not running", mapKey);
}
... | java |
void updateTaskStatus(Tenant tenant, TaskRecord taskRecord, boolean bDeleteClaimRecord) {
String taskID = taskRecord.getTaskID();
DBTransaction dbTran = DBService.instance(tenant).startTransaction();
Map<String, String> propMap = taskRecord.getProperties();
for (String name : propMap.key... | java |
private TaskRecord waitForTaskStatus(Tenant tenant, Task task, Predicate<TaskStatus> pred) {
TaskRecord taskRecord = null;
while (true) {
Iterator<DColumn> colIter =
DBService.instance(tenant).getAllColumns(TaskManagerService.TASKS_STORE_NAME, task.getTaskID()).iterator();
... | java |
private void manageTasks() {
setHostAddress();
while (!m_bShutdown) {
checkAllTasks();
checkForDeadTasks();
try {
Thread.sleep(SLEEP_TIME_MILLIS);
} catch (InterruptedException e) {
}
}
m_executor.shutdown();
... | java |
private void checkTenantTasks(Tenant tenant) {
m_logger.debug("Checking tenant '{}' for needy tasks", tenant);
try {
for (ApplicationDefinition appDef : SchemaService.instance().getAllApplications(tenant)) {
for (Task task : getAppTasks(appDef)) {
checkTas... | java |
private void checkTaskForExecution(ApplicationDefinition appDef, Task task) {
Tenant tenant = Tenant.getTenant(appDef);
m_logger.debug("Checking task '{}' in tenant '{}'", task.getTaskID(), tenant);
synchronized (m_executeLock) {
Iterator<DColumn> colIter =
DBService.... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.