use of org.apache.ignite.internal.util.GridStringBuilder in project ignite by apache.
the class TransactionMetricsAdapter method composeNodeInfo.
/**
* @param ids Ids.
*/
private String composeNodeInfo(final Set<UUID> ids) {
final GridStringBuilder sb = new GridStringBuilder();
sb.a("[");
String delim = "";
for (UUID id : ids) {
sb.a(delim).a(composeNodeInfo(id));
delim = ", ";
}
sb.a("]");
return sb.toString();
}
use of org.apache.ignite.internal.util.GridStringBuilder in project ignite by apache.
the class MavenUtils method downloadArtifact.
/**
* Downloads and stores in local repository an artifact with given identifier.
*
* @param artifact Artifact identifier, must match pattern [groupId:artifactId:version].
* @throws Exception In case of an error.
*/
private static void downloadArtifact(String artifact) throws Exception {
X.println("Downloading artifact... Identifier: " + artifact);
// Default platform independ path for maven settings file.
Path localProxyMavenSettings = Paths.get(System.getProperty("user.home"), ".m2", "local-proxy.xml");
String localProxyMavenSettingsFromEnv = System.getenv("LOCAL_PROXY_MAVEN_SETTINGS");
GridStringBuilder mavenCommandArgs = new SB(" ").a(MAVEN_DEPENDENCY_PLUGIN).a(":get -Dartifact=" + artifact);
if (!isEmpty(localProxyMavenSettingsFromEnv))
localProxyMavenSettings = Paths.get(localProxyMavenSettingsFromEnv);
if (Files.exists(localProxyMavenSettings))
mavenCommandArgs.a(" -s " + localProxyMavenSettings.toString());
else {
Collection<String> repos = new ArrayList<>();
if (useGgRepo)
repos.add(GG_MVN_REPO);
repos.addAll(mavenProjectRepositories());
if (!repos.isEmpty())
mavenCommandArgs.a(" -DremoteRepositories=").a(String.join(",", repos));
}
exec(buildMvnCommand() + mavenCommandArgs.toString());
X.println("Download is finished");
}
use of org.apache.ignite.internal.util.GridStringBuilder in project ignite by apache.
the class GridNearTxLocal method completedTransactionDump.
/**
* Builds dump string for completed transaction.
*
* @param state Transaction state.
* @param systemTimeMillis System time in milliseconds.
* @param userTimeMillis User time in milliseconds.
* @param isLong Whether the dumped transaction is long running or not.
* @return Dump string.
*/
private String completedTransactionDump(TransactionState state, long systemTimeMillis, long userTimeMillis, boolean isLong) {
long cacheOperationsTimeMillis = U.nanosToMillis(systemTime.get() - prepareTime.get() - commitOrRollbackTime.get());
GridStringBuilder warning = new GridStringBuilder(isLong ? "Long transaction time dump " : "Transaction time dump ").a("[startTime=").a(IgniteUtils.DEBUG_DATE_FMT.format(Instant.ofEpochMilli(startTime))).a(", totalTime=").a(systemTimeMillis + userTimeMillis).a(", systemTime=").a(systemTimeMillis).a(", userTime=").a(userTimeMillis).a(", cacheOperationsTime=").a(cacheOperationsTimeMillis);
if (state == COMMITTED) {
warning.a(", prepareTime=").a(timeMillis(prepareTime)).a(", commitTime=").a(timeMillis(commitOrRollbackTime));
} else {
warning.a(", rollbackTime=").a(timeMillis(commitOrRollbackTime));
}
warning.a(", tx=").a(this).a("]");
return warning.toString();
}
use of org.apache.ignite.internal.util.GridStringBuilder in project ignite by apache.
the class IgniteIndexReaderTest method updateQuery.
/**
* Performs an update query.
*
* @param cache Ignite cache.
* @param tblName Table name.
* @param fields List of fields.
* @param cntr Counter which is used to generate data.
*/
private static void updateQuery(IgniteCache cache, String tblName, List<IgnitePair<String>> fields, int cntr) {
GridStringBuilder q = new GridStringBuilder().a("update ").a(tblName).a(" set ").a(fields.stream().map(IgniteBiTuple::get1).collect(joining("=?, ", "", "=?"))).a(" where id=?");
Object[] paramVals = new Object[fields.size() + 1];
for (int i = 0; i < fields.size() + 1; i++) paramVals[i] = (i % 2 == 0) ? cntr : valueOf(cntr);
Object id = paramVals[0];
paramVals[0] = paramVals[paramVals.length - 1];
paramVals[paramVals.length - 1] = id;
query(cache, q.toString(), paramVals);
}
Aggregations