lombok.Synchronized类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(222)

本文整理了Java中lombok.Synchronized类的一些代码示例,展示了Synchronized类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Synchronized类的具体详情如下:
包路径:lombok.Synchronized
类名称:Synchronized

Synchronized介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-gobblin

/**
 * Start the {@link TaskScheduler}.
 *
 * @param name the name of the {@link TaskScheduler}
 */
@Synchronized
final void start(Optional<String> name) {
 if (!this.isStarted) {
  this.startImpl(name);
  this.isStarted = true;
 }
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Gets all currently known channels the user is a part of with the
 * specified level. A {@link UserListEvent} for all channels must of been
 * dispatched before this method will return complete results
 *
 * @param user Known user
 * @return An immutable sorted set of Channels
 */
@Synchronized("accessLock")
public ImmutableSortedSet<C> getChannels(@NonNull U user, @NonNull UserLevel level) {
  return levelsMap.get(level).getChannels(user);
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Check if user exists by nick
 *
 * @param nick Nick of user
 * @return True if user exists
 */
@Synchronized("accessLock")
public boolean containsUser(@NonNull String nick) {
  String nickLowercase = nick.toLowerCase(locale);
  return userNickMap.containsKey(nickLowercase) || privateUsers.containsKey(nickLowercase);
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void removeUserFromChannel(@NonNull U user, @NonNull C channel) {
  mainMap.removeUserFromChannel(user, channel);
  for (UserChannelMap<U, C> curLevelMap : levelsMap.values())
    curLevelMap.removeUserFromChannel(user, channel);
  if (!privateUsers.values().contains(user) && !mainMap.containsUser(user))
    //Completely remove user
    userNickMap.remove(user.getNick().toLowerCase(locale));
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Clears all internal maps
 */
@Synchronized("accessLock")
public void close() {
  mainMap.clear();
  for (UserChannelMap<U, C> curLevelMap : levelsMap.values())
    curLevelMap.clear();
  channelNameMap.clear();
  privateUsers.clear();
  userNickMap.clear();
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Gets all currently known users in a channel that hold the specified
 * UserLevel. A {@link UserListEvent} for the channel must of been
 * dispatched before this method will return complete results
 *
 * @param channel Known channel
 * @param level Level users must hold
 * @return An immutable sorted set of Users
 */
@Synchronized("accessLock")
public ImmutableSortedSet<U> getUsers(@NonNull C channel, @NonNull UserLevel level) {
  return levelsMap.get(level).getUsers(channel);
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void addUserToPrivate(@NonNull U user) {
  String nick = user.getNick().toLowerCase(locale);
  privateUsers.put(nick, user);
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void removeChannel(@NonNull C channel) {
  mainMap.removeChannel(channel);
  for (UserChannelMap<U, C> curLevelMap : levelsMap.values())
    curLevelMap.removeChannel(channel);
  //Remove remaining locations
  channelNameMap.remove(channel.getName());
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void removeUserFromLevel(@NonNull UserLevel level, @NonNull U user, @NonNull C channel) {
  levelsMap.get(level).removeUserFromChannel(user, channel);
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Creates a known channel, internally called when we join a channel
 *
 * @param name
 */
@Synchronized("accessLock")
@SuppressWarnings("unchecked")
public C createChannel(@NonNull String name) {
  C chan = (C) botFactory.createChannel(bot, name);
  channelNameMap.put(name.toLowerCase(locale), chan);
  return chan;
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void removeUser(@NonNull U user) {
  mainMap.removeUser(user);
  for (UserChannelMap<U, C> curLevelMap : levelsMap.values())
    curLevelMap.removeUser(user);
  //Remove remaining locations
  userNickMap.remove(user.getNick().toLowerCase(locale));
  privateUsers.remove(user.getNick().toLowerCase(locale));
}

代码示例来源:origin: apache/incubator-gobblin

/**
 * Closes this {@link TaskScheduler}, ensuring that new tasks cannot be created
 * and cancelling existing tasks.
 *
 * @throws IOException if an I/O error occurs
 */
@Override
@Synchronized
public final void close() throws IOException {
 if (this.isStarted) {
  this.isStarted = false;
  this.closeImpl();
 }
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected boolean levelContainsUser(@NonNull UserLevel level, @NonNull C channel, @NonNull U user) {
  return levelsMap.get(level).containsEntry(user, channel);
}

代码示例来源:origin: com.davidbracewell/mango

@Override
  @Synchronized
  public void combine(@NonNull EnhancedDoubleStatistics statistics) {
   this.eds.combine(statistics);
  }
}//END OF LocalStatisticsAccumulator

代码示例来源:origin: apache/incubator-gobblin

/**
  * Return a StreamEncryptor for the given algorithm and with appropriate parameters.
  * @param algorithm Algorithm to build
  * @param parameters Parameters for algorithm
  * @return A StreamCodec for that algorithm
  * @throws IllegalArgumentException If the given algorithm/parameter pair cannot be built
  */
 @Synchronized
 public static StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) {
  for (EncryptionProvider provider : encryptionProviderLoader) {
   log.debug("Looking for algorithm {} in provider {}", algorithm, provider.getClass().getName());
   StreamCodec codec = provider.buildStreamCryptoProvider(algorithm, parameters);
   if (codec != null) {
    log.debug("Found algorithm {} in provider {}", algorithm, provider.getClass().getName());
    return codec;
   }
  }

  throw new IllegalArgumentException("Could not find a provider to build algorithm " + algorithm + " - is gobblin-crypto-provider in classpath?");
 }
}

代码示例来源:origin: pircbotx/pircbotx

@Synchronized("accessLock")
protected void addUserToLevel(@NonNull UserLevel level, @NonNull U user, @NonNull C channel) {
  levelsMap.get(level).addUserToChannel(user, channel);
}

代码示例来源:origin: pircbotx/pircbotx

/**
 * Get <i>channels we're joined to</i> that the user is joined to as well
 *
 * @param user A known user
 * @return An immutable set of channels
 */
@Synchronized("accessLock")
public ImmutableSortedSet<C> getChannels(@NonNull U user) {
  return mainMap.getChannels(user);
}

代码示例来源:origin: apache/incubator-gobblin

/**
  * Build a CredentialStore with the given config parameters. The type will be extracted from the parameters.
  * See {@link EncryptionConfigParser} for a set of standard configuration parameters, although
  * each encryption provider may have its own arbitrary set.
  * @return A CredentialStore for the given parameters
  * @throws IllegalArgumentException If no provider exists that can build the requested encryption codec
  */
 @Synchronized
 public static CredentialStore buildCredentialStore(Map<String, Object> parameters) {
  String credType = EncryptionConfigParser.getKeystoreType(parameters);

  for (CredentialStoreProvider provider : credentialStoreProviderLoader) {
   log.debug("Looking for cred store type {} in provider {}", credType, provider.getClass().getName());
   CredentialStore credStore = provider.buildCredentialStore(parameters);
   if (credStore != null) {
    log.debug("Found cred store type {} in provider {}", credType, provider.getClass().getName());
    return credStore;
   }
  }

  throw new IllegalArgumentException("Could not find a provider to build algorithm " + credType + " - is gobblin-crypto-provider in classpath?");
 }
}

代码示例来源:origin: com.davidbracewell/mango

@Override
@Synchronized
public void add(@NonNull Double aDouble) {
 eds.accept(aDouble);
}

代码示例来源:origin: testcontainers/testcontainers-java

@Synchronized
public DockerClient client() {

相关文章