Tabnine Logo
GridStringBuilder.toString
Code IndexAdd Tabnine to your IDE (free)

How to use
toString
method
in
org.apache.ignite.internal.util.GridStringBuilder

Best Java code snippets using org.apache.ignite.internal.util.GridStringBuilder.toString (Showing top 20 results out of 315)

origin: apache/ignite

/**
 * Dumps stack trace of the thread to the given log at warning level.
 *
 * @param t Thread to be dumped.
 * @param log Logger.
 */
public static void dumpThread(Thread t, @Nullable IgniteLogger log) {
  ThreadMXBean mxBean = ManagementFactory.getThreadMXBean();
  GridStringBuilder sb = new GridStringBuilder();
  printThreadInfo(mxBean.getThreadInfo(t.getId()), sb, Collections.emptySet());
  warn(log, sb.toString());
}
origin: apache/ignite

/**
 * Gets a hex string representation of the given long value.
 *
 * @param val Value to convert to string.
 * @return Hex string.
 */
public static String hexInt(int val) {
  return new SB().appendHex(val).toString();
}
origin: apache/ignite

/**
 * Gets a hex string representation of the given long value.
 *
 * @param val Value to convert to string.
 * @return Hex string.
 */
public static String hexLong(long val) {
  return new SB().appendHex(val).toString();
}
origin: apache/ignite

/**
 * @param code Code lines.
 */
private void finish(Collection<String> code, String readClsName) {
  assert code != null;
  if (!fields.isEmpty()) {
    code.add(builder().a("}").toString());
    code.add(EMPTY);
  }
  if (readClsName == null)
    code.add(builder().a("return true;").toString());
  else
    code.add(builder().a("return reader.afterMessageRead(").a(readClsName).a(".class);").toString());
}
origin: apache/ignite

/**
 * Creates String key used for equality and hashing.
 */
private String createEqualityKey() {
  GridStringBuilder sb = new GridStringBuilder("(").a(usr).a(")@");
  if (uri.getScheme() != null)
    sb.a(uri.getScheme().toLowerCase());
  sb.a("://");
  if (uri.getAuthority() != null)
    sb.a(uri.getAuthority().toLowerCase());
  return sb.toString();
}
origin: apache/ignite

/**
 * Returns new file name for the given key. Since fine name is based on the key,
 * the key must be unique. This method converts string key into hexadecimal-based
 * string to avoid conflicts of special characters in file names.
 *
 * @param key Unique checkpoint key.
 * @return Unique checkpoint file name.
 */
private String getUniqueFileName(CharSequence key) {
  assert key != null;
  SB sb = new SB();
  // To be overly safe we'll limit file name size
  // to 128 characters (124 characters name + 4 character extension).
  // We also limit file name to upper case only to avoid surprising
  // behavior between Windows and Unix file systems.
  for (int i = 0; i < key.length() && i < 124; i++)
    sb.a(CODES.charAt(key.charAt(i) % CODES_LEN));
  return sb.a(".gcp").toString();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public String toString() {
  if (tail == null)
    return super.toString();
  else {
    int tailLen = tail.length();
    StringBuilder res = new StringBuilder(impl().capacity() + tailLen + 100);
    res.append(impl());
    if (tail.getSkipped() > 0) {
      res.append("... and ").append(String.valueOf(tail.getSkipped() + tailLen))
        .append(" skipped ...");
    }
    res.append(tail.toString());
    return res.toString();
  }
}
origin: apache/ignite

/**
 * Join input parameters with space and wrap optional braces {@code []}.
 *
 * @param params Other input parameter.
 * @return Joined parameters wrapped optional braces.
 */
private static String op(Object... params) {
  return j(new SB(), "[", " ", params).a("]").toString();
}
origin: apache/ignite

/**
 * Join input parameters with space and wrap grouping braces {@code ()}.
 *
 * @param params Input parameter.
 * @return Joined parameters wrapped grouped braces.
 */
private static String g(Object... params) {
  return j(new SB(), "(", " ", params).a(")").toString();
}
origin: apache/ignite

/**
 * Concatenates elements using provided delimiter.
 *
 * @param str Repeated string.
 * @param cnt Repeat count.
 * @param start Start string.
 * @param sep Separator.
 * @param end End string.
 */
protected static String repeat(String str, int cnt, String start, String sep, String end) {
  SB sb = new SB(str.length() * cnt + sep.length() * (cnt - 1) + start.length() + end.length());
  sb.a(start);
  for (int i = 0; i < cnt; i++) {
    if (i > 0)
      sb.a(sep);
    sb.a(str);
  }
  return sb.a(end).toString();
}
origin: apache/ignite

/**
 * @param code Code lines.
 * @param accessor Field or method name.
 * @param args Method arguments.
 */
private void returnFalseIfFailed(Collection<String> code, String accessor, @Nullable String... args) {
  assert code != null;
  assert accessor != null;
  String argsStr = "";
  if (args != null && args.length > 0) {
    for (String arg : args)
      argsStr += arg + ", ";
    argsStr = argsStr.substring(0, argsStr.length() - 2);
  }
  code.add(builder().a("if (!").a(accessor).a("(").a(argsStr).a("))").toString());
  indent++;
  code.add(builder().a("return false;").toString());
  indent--;
}
origin: apache/ignite

  /** {@inheritDoc} */
  @Override public String toString() {
    if (!S.INCLUDE_SENSITIVE)
      return "[size=" + size() + "]";
    Iterator<Cache.Entry<?, ?>> it = iterator();
    if (!it.hasNext())
      return "[]";
    SB sb = new SB("[");
    while (true) {
      Cache.Entry<?, ?> e = it.next();
      sb.a(e.toString());
      if (!it.hasNext())
        return sb.a(']').toString();
      sb.a(", ");
    }
  }
}
origin: apache/ignite

/**
 * Short node representation.
 *
 * @param ns Grid nodes.
 * @return Short string representing the node.
 */
public static String toShortString(Collection<? extends ClusterNode> ns) {
  SB sb = new SB("Grid nodes [cnt=" + ns.size());
  for (ClusterNode n : ns)
    sb.a(", ").a(toShortString(n));
  return sb.a(']').toString();
}
origin: apache/ignite

/**
 * Concatenates elements using provided separator.
 *
 * @param elems Concatenated elements.
 * @param f closure used for transform element.
 * @param start Start string.
 * @param sep Separator.
 * @param end End string.
 * @return Concatenated string.
 */
protected static <T> String mkString(Iterable<T> elems, C1<T, String> f, String start, String sep, String end) {
  SB sb = new SB(start);
  boolean first = true;
  for (T elem : elems) {
    if (!first)
      sb.a(sep);
    sb.a(f.apply(elem));
    first = false;
  }
  return sb.a(end).toString();
}
origin: apache/ignite

/**
 * @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();
}
origin: apache/ignite

  /** {@inheritDoc} */
  @Override public String toString() {
    return new SB("FullPageId [pageId=").appendHex(pageId)
      .a(", effectivePageId=").appendHex(effectivePageId)
      .a(", grpId=").a(grpId).a(']').toString();
  }
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public String toString() {
  return new SB("Tail[").a("pageId=").appendHex(pageId).a(", cnt= ").a(getCount())
    .a(", lvl=" + lvl).a(", sibling=").a(sibling).a("]").toString();
}
origin: apache/ignite

  /**
   * @param addr Address.
   */
  public static String printPage(long addr, int pageSize) throws IgniteCheckedException {
    PageIO io = getPageIO(addr);

    GridStringBuilder sb = new GridStringBuilder("Header [\n\ttype=");

    sb.a(getType(addr)).a(" (").a(io.getClass().getSimpleName())
      .a("),\n\tver=").a(getVersion(addr)).a(",\n\tcrc=").a(getCrc(addr))
      .a(",\n\t").a(PageIdUtils.toDetailString(getPageId(addr)))
      .a("\n],\n");

    io.printPage(addr, pageSize, sb);

    return sb.toString();
  }
}
origin: apache/ignite

/**
 * Verifies all nodes in current cluster topology support BaselineTopology feature so compatibilityMode flag is
 * enabled to reset.
 *
 * @param discoCache
 */
private void verifyBaselineTopologySupport(DiscoCache discoCache) {
  if (discoCache.minimumServerNodeVersion().compareTo(MIN_BLT_SUPPORTING_VER) < 0) {
    SB sb = new SB("Cluster contains nodes that don't support BaselineTopology: [");
    for (ClusterNode cn : discoCache.serverNodes()) {
      if (cn.version().compareTo(MIN_BLT_SUPPORTING_VER) < 0)
        sb
          .a("[")
          .a(cn.consistentId())
          .a(":")
          .a(cn.version())
          .a("], ");
    }
    sb.d(sb.length() - 2, sb.length());
    throw new IgniteException(sb.a("]").toString());
  }
}
origin: apache/ignite

/**
 * Test write operations logging.
 *
 * @throws Exception If failed.
 */
@Test
public void testLogWrite() throws Exception {
  IgfsLogger log = IgfsLogger.logger(ENDPOINT, IGFS_NAME, LOG_DIR, 10);
  log.logCreate(1, PATH, true, 2, new Integer(3).shortValue(), 4L);
  log.logAppend(2, PATH, 8);
  log.logCloseOut(2, 9L, 10L, 11);
  log.close();
  checkLog(
    new SB().a(U.jvmPid() + d() + TYPE_OPEN_OUT + d() + PATH_STR_ESCAPED + d() + d() + 1 + d() +
      2 + d(2) + 0 + d() + 1 + d() + 3 + d() + 4 + d(10)).toString(),
    new SB().a(U.jvmPid() + d() + TYPE_OPEN_OUT + d() + PATH_STR_ESCAPED + d() + d() + 2 + d() +
      8 + d(2) + 1 + d(13)).toString(),
    new SB().a(U.jvmPid() + d() + TYPE_CLOSE_OUT + d(3) + 2 + d(11) + 9 + d() + 10 + d() + 11 + d(3))
      .toString()
  );
}
org.apache.ignite.internal.utilGridStringBuildertoString

Javadoc

Popular methods of GridStringBuilder

  • a
  • <init>
  • appendHex
    Appends given long value as a hex string to this string builder.
  • appendCodePoint
  • i
  • setLength

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • compareTo (BigDecimal)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now