Java Code Examples for org.apache.commons.codec.binary.StringUtils
The following examples show how to use
org.apache.commons.codec.binary.StringUtils. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: airsonic-advanced Source File: SonosLinkSecurityInterceptor.java License: GNU General Public License v3.0 | 6 votes |
@Override public void check(DecodedJWT jwt) throws InsufficientAuthenticationException { AuthenticationType authenticationType = AuthenticationType.valueOf(settingsService.getSonosLinkMethod()); // no need for extra checks because there isn't a link code if (authenticationType == AuthenticationType.ANONYMOUS) { return; } String linkcode = jwt.getClaim(CLAIM_LINKCODE).asString(); SonosLink sonosLink = sonosLinkDao.findByLinkcode(linkcode); if (!StringUtils.equals(jwt.getSubject(), sonosLink.getUsername()) || !StringUtils.equals(linkcode, sonosLink.getLinkcode()) || !StringUtils.equals(jwt.getClaim(CLAIM_HOUSEHOLDID).asString(), sonosLink.getHouseholdId())) { throw new InsufficientAuthenticationException("Sonos creds not valid"); } }
Example 2
Source Project: rya Source File: TemporalInstantTest.java License: Apache License 2.0 | 6 votes |
@Test public void zoneTestTest() throws Exception { final String ZONETestDateInBRST = "2014-12-31T23:59:59-02:00"; // arbitrary zone, BRST=Brazil, better if not local. final String ZONETestDateInZulu = "2015-01-01T01:59:59Z"; final String ZONETestDateInET = "2014-12-31T20:59:59-05:00"; TemporalInstant instant = new TemporalInstantRfc3339(DateTime.parse(ZONETestDateInBRST)); Assert.assertEquals("Test our test Zulu, ET strings.", ZONETestDateInET, DateTime.parse(ZONETestDateInZulu).withZone(DateTimeZone.forID("-05:00")).toString(ISODateTimeFormat.dateTimeNoMillis())); Assert.assertEquals("Test our test BRST,Zulu strings.", ZONETestDateInZulu, DateTime.parse(ZONETestDateInBRST).withZone(DateTimeZone.UTC).toString(ISODateTimeFormat.dateTimeNoMillis())); Assert.assertTrue("Key must be normalized to time zone Zulu: "+instant.getAsKeyString(), instant.getAsKeyString().endsWith("Z")); Assert.assertEquals("Key must be normalized from BRST -02:00", ZONETestDateInZulu, instant.getAsKeyString()); Assert.assertArrayEquals(StringUtils.getBytesUtf8(instant.getAsKeyString()), instant.getAsKeyBytes()); Assert.assertTrue( "Ignore original time zone.", ! ZONETestDateInBRST.equals( instant.getAsReadable(DateTimeZone.forID("-07:00")))); Assert.assertEquals( "Use original time zone.", ZONETestDateInBRST, instant.getAsDateTime().toString(TemporalInstantRfc3339.FORMATTER)); Assert.assertEquals( "Time at specified time zone.", ZONETestDateInET, instant.getAsReadable(DateTimeZone.forID("-05:00"))); instant = new TemporalInstantRfc3339(DateTime.parse(ZONETestDateInZulu)); Assert.assertEquals("expect a time with specified time zone.", ZONETestDateInET, instant.getAsReadable(DateTimeZone.forID("-05:00"))); }
Example 3
Source Project: h2o-2 Source File: VM.java License: Apache License 2.0 | 6 votes |
static String write(Serializable s) { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(s); return StringUtils.newStringUtf8(Base64.encodeBase64(bos.toByteArray(), false)); } finally { out.close(); bos.close(); } } catch( Exception ex ) { throw Log.errRTExcept(ex); } }
Example 4
Source Project: DDMQ Source File: KafkaProduceOffsetFetcher.java License: Apache License 2.0 | 6 votes |
public KafkaProduceOffsetFetcher(String zkHost) { this.zkClient = new ZkClient(zkHost, SESSION_TIMEOUT, CONNECTION_TIMEOUT, new ZkSerializer() { @Override public byte[] serialize(Object o) throws ZkMarshallingError { return ((String) o).getBytes(); } @Override public Object deserialize(byte[] bytes) throws ZkMarshallingError { if (bytes == null) { return null; } else { return StringUtils.newStringUtf8(bytes); } } }); }
Example 5
Source Project: text_converter Source File: RFC1522Codec.java License: GNU General Public License v3.0 | 6 votes |
/** * Applies an RFC 1522 compliant encoding scheme to the given string of text with the given charset. * <p> * This method constructs the "encoded-word" header common to all the RFC 1522 codecs and then invokes * {@link #doEncoding(byte [])} method of a concrete class to perform the specific encoding. * * @param text * a string to encode * @param charset * a charset to be used * @return RFC 1522 compliant "encoded-word" * @throws EncoderException * thrown if there is an error condition during the Encoding process. * @see <a href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a> */ protected String encodeText(final String text, final Charset charset) throws EncoderException { if (text == null) { return null; } final StringBuilder buffer = new StringBuilder(); buffer.append(PREFIX); buffer.append(charset); buffer.append(SEP); buffer.append(this.getEncoding()); buffer.append(SEP); final byte [] rawData = this.doEncoding(text.getBytes(charset)); buffer.append(StringUtils.newStringUsAscii(rawData)); buffer.append(POSTFIX); return buffer.toString(); }
Example 6
Source Project: samza Source File: JobsClient.java License: Apache License 2.0 | 6 votes |
/** * This method initiates http get request on the request url and returns the * response returned from the http get. * @param requestUrl url on which the http get request has to be performed. * @return the http get response. * @throws IOException if there are problems with the http get request. */ private byte[] httpGet(String requestUrl) throws IOException { GetMethod getMethod = new GetMethod(requestUrl); try { int responseCode = httpClient.executeMethod(getMethod); LOG.debug("Received response code: {} for the get request on the url: {}", responseCode, requestUrl); byte[] response = getMethod.getResponseBody(); if (responseCode != HttpStatus.SC_OK) { throw new SamzaException(String.format("Received response code: %s for get request on: %s, with message: %s.", responseCode, requestUrl, StringUtils.newStringUtf8(response))); } return response; } finally { getMethod.releaseConnection(); } }
Example 7
Source Project: secure-data-service Source File: AesCipher.java License: Apache License 2.0 | 6 votes |
@Override public Object decrypt(String data) { String[] splitData = org.apache.commons.lang3.StringUtils.split(data, ':'); // String[] splitData = data.split(":"); if (splitData.length != 2) { return null; } else { if (splitData[0].equals("ESTRING")) { return StringUtils.newStringUtf8(decryptToBytes(splitData[1])); } else if (splitData[0].equals("EBOOL")) { return decryptBinary(splitData[1], Boolean.class); } else if (splitData[0].equals("EINT")) { return decryptBinary(splitData[1], Integer.class); } else if (splitData[0].equals("ELONG")) { return decryptBinary(splitData[1], Long.class); } else if (splitData[0].equals("EDOUBLE")) { return decryptBinary(splitData[1], Double.class); } else { return null; } } }
Example 8
Source Project: WeBASE-Collect-Bee Source File: BlockCheckService.java License: Apache License 2.0 | 5 votes |
public void checkForks(long currentBlockHeight) throws IOException { log.info("current block height is {}, and begin to check forks", currentBlockHeight); List<BlockTaskPool> uncertainBlocks = blockTaskPoolRepository.findByCertainty((short) BlockCertaintyEnum.UNCERTAIN.getCertainty()); for (BlockTaskPool pool : uncertainBlocks) { if (pool.getBlockHeight() <= currentBlockHeight - BlockConstants.MAX_FORK_CERTAINTY_BLOCK_NUMBER) { if (pool.getSyncStatus() == TxInfoStatusEnum.DOING.getStatus()) { log.error("block {} is doing!", pool.getBlockHeight()); continue; } if (pool.getSyncStatus() == TxInfoStatusEnum.INIT.getStatus()) { log.error("block {} is not sync!", pool.getBlockHeight()); blockTaskPoolRepository.setCertaintyByBlockHeight((short) BlockCertaintyEnum.FIXED.getCertainty(), pool.getBlockHeight()); continue; } Block block = ethClient.getBlock(BigInteger.valueOf(pool.getBlockHeight())); String newHash = block.getHash(); if (!StringUtils.equals(newHash, blockDetailInfoDAO.getBlockDetailInfoByBlockHeight(pool.getBlockHeight()).getBlockHash())) { log.info("Block {} is forked!!! ready to resync", pool.getBlockHeight()); rollBackService.rollback(pool.getBlockHeight(), pool.getBlockHeight() + 1); blockTaskPoolRepository.setSyncStatusAndCertaintyByBlockHeight( (short) TxInfoStatusEnum.INIT.getStatus(), (short) BlockCertaintyEnum.FIXED.getCertainty(), pool.getBlockHeight()); } else { log.info("Block {} is not forked!", pool.getBlockHeight()); blockTaskPoolRepository.setCertaintyByBlockHeight((short) BlockCertaintyEnum.FIXED.getCertainty(), pool.getBlockHeight()); } } } }
Example 9
Source Project: fast-family-master Source File: CustomAuthenticationSuccessHandler.java License: Apache License 2.0 | 5 votes |
@Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { String header = request.getHeader("Authorization"); if (header == null || !header.startsWith("Basic ")) { throw new UnapprovedClientAuthenticationException("请求头中无client信息"); } String[] tokens = this.extractAndDecodeHeader(header, request); if (tokens.length != 2) { throw new BadCredentialsException("Invalid basic authentication token"); } String clientId = tokens[0]; String clientSecret = tokens[1]; ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId); if (clientDetails == null) { throw new UnapprovedClientAuthenticationException("clientId 对应的配置信息不存在" + clientId); } else if (!StringUtils.equals(clientDetails.getClientSecret(), clientSecret)) { throw new UnapprovedClientAuthenticationException("clientSecret 不匹配" + clientId); } TokenRequest tokenRequest = new TokenRequest(new HashMap<>(), clientId, clientDetails.getScope(), "custom"); OAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails); OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication); OAuth2AccessToken token = authorizationServerTokenServices.createAccessToken(oAuth2Authentication); //此处可自定义扩展返回结果。 extendAuthenticationSuccessHandler.customAuthenticationSuccessResult(response, token, authentication); }
Example 10
Source Project: fabric-net-server Source File: FabricManager.java License: Apache License 2.0 | 5 votes |
public void setUser(String leagueName, String orgName, String peerName, String username, String skPath, String certificatePath) throws InvalidArgumentException { if (StringUtils.equals(username, org.getUsername())) { return; } User user = org.getUser(username); if (null == user) { IntermediateUser intermediateUser = new IntermediateUser(leagueName, orgName, peerName, username, skPath, certificatePath); org.setUsername(username); org.addUser(leagueName, orgName, peerName, intermediateUser, org.getFabricStore()); } org.getClient().setUserContext(org.getUser(username)); }
Example 11
Source Project: nano-framework Source File: InjectorTest.java License: Apache License 2.0 | 5 votes |
@Test public void injectorSingletionObjectTest() { Injector injector = Guice.createInjector(); EntitySingleton entity1 = injector.getInstance(EntitySingleton.class); EntitySingleton entity2 = injector.getInstance(EntitySingleton.class); Assert.assertEquals(StringUtils.equals(entity1.uuid, entity2.uuid), true); }
Example 12
Source Project: blockchain Source File: Block.java License: MIT License | 5 votes |
/** * Calculate new hash based on blocks contents * @param block 区块 * @return */ public static String calculateHash(Block block) { String record = block.getIndex() + block.getTimestamp() + block.getNonce() + block.getPrevHash()+block.getMerkleRoot(); MessageDigest digest = DigestUtils.getSha256Digest(); byte[] hash = digest.digest(StringUtils.getBytesUtf8(record)); return Hex.encodeHexString(hash); }
Example 13
Source Project: incubator-retired-blur Source File: Base64.java License: Apache License 2.0 | 5 votes |
/** * Serialize to Base64 as a String, non-chunked. */ public static String encodeBase64String(byte[] data) { /* * Based on implementation of this same name function in commons-codec 1.5+. * in commons-codec 1.4, the second param sets chunking to true. */ return StringUtils.newStringUtf8(org.apache.commons.codec.binary.Base64.encodeBase64(data, false)); }
Example 14
Source Project: text_converter Source File: RFC1522Codec.java License: GNU General Public License v3.0 | 5 votes |
/** * Applies an RFC 1522 compliant decoding scheme to the given string of text. * <p> * This method processes the "encoded-word" header common to all the RFC 1522 codecs and then invokes * {@link #doEncoding(byte [])} method of a concrete class to perform the specific decoding. * * @param text * a string to decode * @return A new decoded String or <code>null</code> if the input is <code>null</code>. * @throws DecoderException * thrown if there is an error condition during the decoding process. * @throws UnsupportedEncodingException * thrown if charset specified in the "encoded-word" header is not supported */ protected String decodeText(final String text) throws DecoderException, UnsupportedEncodingException { if (text == null) { return null; } if (!text.startsWith(PREFIX) || !text.endsWith(POSTFIX)) { throw new DecoderException("RFC 1522 violation: malformed encoded content"); } final int terminator = text.length() - 2; int from = 2; int to = text.indexOf(SEP, from); if (to == terminator) { throw new DecoderException("RFC 1522 violation: charset token not found"); } final String charset = text.substring(from, to); if (charset.equals("")) { throw new DecoderException("RFC 1522 violation: charset not specified"); } from = to + 1; to = text.indexOf(SEP, from); if (to == terminator) { throw new DecoderException("RFC 1522 violation: encoding token not found"); } final String encoding = text.substring(from, to); if (!getEncoding().equalsIgnoreCase(encoding)) { throw new DecoderException("This codec cannot decode " + encoding + " encoded content"); } from = to + 1; to = text.indexOf(SEP, from); byte[] data = StringUtils.getBytesUsAscii(text.substring(from, to)); data = doDecoding(data); return new String(data, charset); }
Example 15
Source Project: tutorials Source File: StringEncodeUnitTest.java License: MIT License | 5 votes |
@Test public void givenSomeUnencodedString_whenApacheCommonsCodecEncode_thenCompareEquals() { String rawString = "Entwickeln Sie mit Vergnügen"; byte[] bytes = StringUtils.getBytesUtf8(rawString); String utf8EncodedString = StringUtils.newStringUtf8(bytes); assertEquals(rawString, utf8EncodedString); }
Example 16
Source Project: gravitee-management-rest-api Source File: AuthenticationSuccessListener.java License: Apache License 2.0 | 5 votes |
public String computePicture(final byte[] pictureData) { String pictureContent = new String(pictureData); if(pictureContent.toUpperCase().startsWith("HTTP")) { return pictureContent; } try { String contentType = URLConnection.guessContentTypeFromStream(new ByteArrayInputStream(pictureData)); if(contentType != null) { StringBuilder sb = new StringBuilder(); sb.append("data:"); sb.append(contentType); sb.append(";base64,"); sb.append(StringUtils.newStringUtf8(Base64.encodeBase64(pictureData, false))); return sb.toString(); } else { //null contentType means that pictureData is a String but doesn't starts with HTTP LOGGER.warn("Unable to compute the user picture from URL."); } } catch (IOException e) { LOGGER.warn("Problem while parsing picture", e); } return null; }
Example 17
Source Project: discord.jar Source File: AccountManagerImpl.java License: The Unlicense | 5 votes |
@Override public void setAvatar(InputStream is) throws IOException { updateLocalVars(); this.avatar = "data:image/jpeg;base64," + StringUtils.newStringUtf8(Base64.encodeBase64(IOUtils.toByteArray (is), false)); updateEdits(); }
Example 18
Source Project: neoscada Source File: JdbcStorageDaoBase64Impl.java License: Eclipse Public License 1.0 | 5 votes |
@Override public void writeNode ( final DataNode node ) { final String data; if ( node != null && node.getData () != null ) { data = StringUtils.newStringUtf8 ( Base64.encodeBase64 ( node.getData (), true ) ); } else { data = null; } logger.debug ( "Write data node: {} -> {}", node, data ); this.accessor.doWithConnection ( new CommonConnectionTask<Void> () { @Override protected Void performTask ( final ConnectionContext connectionContext ) throws Exception { connectionContext.setAutoCommit ( false ); deleteNode ( connectionContext, node.getId () ); insertNode ( connectionContext, node, data ); connectionContext.commit (); return null; } } ); }
Example 19
Source Project: neoscada Source File: ChartView.java License: Eclipse Public License 1.0 | 5 votes |
@Override public void saveState ( final IMemento memento ) { super.saveState ( memento ); if ( memento == null ) { return; } final Resource resource = new XMIResourceFactoryImpl ().createResource ( null ); resource.getContents ().add ( this.configuration ); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream (); final Map<?, ?> options = new HashMap<Object, Object> (); try { resource.save ( outputStream, options ); final IMemento child = memento.createChild ( CHILD_CONFIGURATION ); child.putTextData ( StringUtils.newStringUtf8 ( Base64.encodeBase64 ( outputStream.toByteArray (), true ) ) ); } catch ( final Exception e ) { StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG ); } }
Example 20
Source Project: cyberduck Source File: DriveMoveFeature.java License: GNU General Public License v3.0 | 5 votes |
@Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final String id = fileid.getFileid(file, new DisabledListProgressListener()); if(!StringUtils.equals(file.getName(), renamed.getName())) { // Rename title final File properties = new File(); properties.setName(renamed.getName()); properties.setMimeType(status.getMime()); session.getClient().files().update(id, properties). setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute(); } // Retrieve the existing parents to remove final StringBuilder previousParents = new StringBuilder(); final File reference = session.getClient().files().get(id) .setFields("parents") .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")) .execute(); for(String parent : reference.getParents()) { previousParents.append(parent); previousParents.append(','); } // Move the file to the new folder session.getClient().files().update(id, null) .setAddParents(fileid.getFileid(renamed.getParent(), new DisabledListProgressListener())) .setRemoveParents(previousParents.toString()) .setFields("id, parents") .setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")) .execute(); return new Path(renamed.getParent(), renamed.getName(), renamed.getType(), new DriveAttributesFinderFeature(session, fileid).find(renamed)); } catch(IOException e) { throw new DriveExceptionMappingService().map("Cannot rename {0}", e, file); } }
Example 21
Source Project: JWT4B Source File: CustomJWToken.java License: GNU General Public License v3.0 | 5 votes |
public CustomJWToken(String token) { if (token != null) { final String[] parts = splitToken(token); try { headerJson = StringUtils.newStringUtf8(Base64.decodeBase64(parts[0])); payloadJson = StringUtils.newStringUtf8(Base64.decodeBase64(parts[1])); checkRegisteredClaims(payloadJson); } catch (NullPointerException e) { Output.outputError("The UTF-8 Charset isn't initialized (" + e.getMessage() + ")"); } signature = Base64.decodeBase64(parts[2]); } }
Example 22
Source Project: JWT4B Source File: CustomJWToken.java License: GNU General Public License v3.0 | 5 votes |
public static boolean isValidJWT(String token) { if (org.apache.commons.lang.StringUtils.countMatches(token, ".") != 2) { return false; } try { JWT.decode(token); return true; } catch (JWTDecodeException exception) { } return false; }
Example 23
Source Project: raccoon4 Source File: Traits.java License: Apache License 2.0 | 5 votes |
protected static String[] interpret(String inp, String mix) { byte[] dec = Base64.decodeBase64(inp); byte[] key = mix.getBytes(); int idx = 0; for (int i = 0; i < dec.length; i++) { dec[i] = (byte) (dec[i] ^ key[idx]); idx = (idx + 1) % key.length; } return StringUtils.newStringUtf8(dec).split(SEP); }
Example 24
Source Project: pivaa Source File: RFC1522Codec.java License: GNU General Public License v3.0 | 5 votes |
/** * Applies an RFC 1522 compliant decoding scheme to the given string of text. * <p> * This method processes the "encoded-word" header common to all the RFC 1522 codecs and then invokes * {@link #doEncoding(byte [])} method of a concrete class to perform the specific decoding. * * @param text * a string to decode * @return A new decoded String or <code>null</code> if the input is <code>null</code>. * @throws DecoderException * thrown if there is an error condition during the decoding process. * @throws UnsupportedEncodingException * thrown if charset specified in the "encoded-word" header is not supported */ protected String decodeText(final String text) throws DecoderException, UnsupportedEncodingException { if (text == null) { return null; } if (!text.startsWith(PREFIX) || !text.endsWith(POSTFIX)) { throw new DecoderException("RFC 1522 violation: malformed encoded content"); } final int terminator = text.length() - 2; int from = 2; int to = text.indexOf(SEP, from); if (to == terminator) { throw new DecoderException("RFC 1522 violation: charset token not found"); } final String charset = text.substring(from, to); if (charset.equals("")) { throw new DecoderException("RFC 1522 violation: charset not specified"); } from = to + 1; to = text.indexOf(SEP, from); if (to == terminator) { throw new DecoderException("RFC 1522 violation: encoding token not found"); } final String encoding = text.substring(from, to); if (!getEncoding().equalsIgnoreCase(encoding)) { throw new DecoderException("This codec cannot decode " + encoding + " encoded content"); } from = to + 1; to = text.indexOf(SEP, from); byte[] data = StringUtils.getBytesUsAscii(text.substring(from, to)); data = doDecoding(data); return new String(data, charset); }
Example 25
Source Project: nano-framework Source File: InjectorTest.java License: Apache License 2.0 | 5 votes |
@Test public void injectorObjectTest() { Injector injector = Guice.createInjector(); Entity entity1 = injector.getInstance(Entity.class); Entity entity2 = injector.getInstance(Entity.class); Assert.assertEquals(StringUtils.equals(entity1.uuid, entity2.uuid), false); }
Example 26
Source Project: nano-framework Source File: Node.java License: Apache License 2.0 | 5 votes |
public void setUptime(final Long uptime) { if (StringUtils.equals(String.valueOf(this.uptime), String.valueOf(uptime))) { return; } this.uptime = uptime; kvClient.putValue(config.getClusterId() + "/Node/" + id + "/uptime", String.valueOf(uptime)); }
Example 27
Source Project: shardingsphere Source File: RC4EncryptAlgorithm.java License: Apache License 2.0 | 5 votes |
@Override public String encrypt(final Object plaintext) { if (null == plaintext) { return null; } byte[] result = handle(StringUtils.getBytesUtf8(String.valueOf(plaintext)), key); return Base64.encodeBase64String(result); }
Example 28
Source Project: nano-framework Source File: Node.java License: Apache License 2.0 | 5 votes |
public void setHost(final String host) { if (StringUtils.equals(this.host, host)) { return; } this.host = host; kvClient.putValue(config.getClusterId() + "/Node/" + id + "/host", host); }
Example 29
Source Project: ymate-platform-v2 Source File: CodecUtils.java License: Apache License 2.0 | 5 votes |
@Override public Key toKey(byte[] key) throws Exception { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); KeySpec spec = new PBEKeySpec(StringUtils.newStringUtf8(key).toCharArray(), key, ITERATION_COUNT, KEY_SIZE); SecretKey tmp = factory.generateSecret(spec); return new SecretKeySpec(tmp.getEncoded(), CIPHER_ALGORITHM); }
Example 30
Source Project: nano-framework Source File: Node.java License: Apache License 2.0 | 5 votes |
public void setLivetime(final Long livetime) { if (StringUtils.equals(String.valueOf(this.livetime), String.valueOf(livetime))) { return; } this.livetime = livetime; kvClient.putValue(config.getClusterId() + "/Node/" + id + "/livetime", String.valueOf(livetime)); }