[ 
https://issues.apache.org/jira/browse/GEODE-2497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876856#comment-15876856
 ] 

ASF GitHub Bot commented on GEODE-2497:
---------------------------------------

Github user kirklund commented on a diff in the pull request:

    https://github.com/apache/geode/pull/402#discussion_r102332744
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager.java
 ---
    @@ -978,43 +977,33 @@ public void run() {
     
       /** starts periodic task to perform cleanup chores such as expire 
surprise members */
       private void startCleanupTimer() {
    -    latestViewWriteLock.lock();
    -    try {
    -      if (this.cleanupTimer != null) {
    -        return;
    -      }
    -      DistributedSystem ds = InternalDistributedSystem.getAnyInstance();
    -      if (ds != null && ds.isConnected()) {
    -        this.cleanupTimer = new SystemTimer(ds, true);
    -        SystemTimer.SystemTimerTask st = new SystemTimer.SystemTimerTask() 
{
    -          @Override
    -          public void run2() {
    -            latestViewWriteLock.lock();
    -            try {
    -              long oldestAllowed = System.currentTimeMillis() - 
surpriseMemberTimeout;
    -              for (Iterator it = surpriseMembers.entrySet().iterator(); 
it.hasNext();) {
    -                Map.Entry entry = (Map.Entry) it.next();
    -                Long birthtime = (Long) entry.getValue();
    -                if (birthtime.longValue() < oldestAllowed) {
    -                  it.remove();
    -                  InternalDistributedMember m = 
(InternalDistributedMember) entry.getKey();
    -                  logger.info(LocalizedMessage.create(
    -                      
LocalizedStrings.GroupMembershipService_MEMBERSHIP_EXPIRING_MEMBERSHIP_OF_SURPRISE_MEMBER_0,
    -                      m));
    -                  removeWithViewLock(m, true,
    -                      "not seen in membership view in " + 
surpriseMemberTimeout + "ms");
    -                }
    -              }
    -            } finally {
    -              latestViewWriteLock.unlock();
    +    DistributedSystem ds = this.dcReceiver.getDM().getSystem();
    +    this.cleanupTimer = new SystemTimer(ds, true);
    +    SystemTimer.SystemTimerTask st = new SystemTimer.SystemTimerTask() {
    +      @Override
    +      public void run2() {
    +        latestViewWriteLock.lock();
    +        try {
    +          long oldestAllowed = System.currentTimeMillis() - 
surpriseMemberTimeout;
    +          for (Iterator it = surpriseMembers.entrySet().iterator(); 
it.hasNext();) {
    +            Map.Entry entry = (Map.Entry) it.next();
    +            Long birthtime = (Long) entry.getValue();
    +            if (birthtime.longValue() < oldestAllowed) {
    --- End diff --
    
    As I find deeply nested blocks like this, I've been extracting them to 
private methods in the class. The entire run-block could be extracted to one 
method and/or you could break it up into multiple methods.


> surprise members are never timed out during startup
> ---------------------------------------------------
>
>                 Key: GEODE-2497
>                 URL: https://issues.apache.org/jira/browse/GEODE-2497
>             Project: Geode
>          Issue Type: Bug
>          Components: membership
>            Reporter: Bruce Schuchardt
>            Assignee: Bruce Schuchardt
>
> A system was observed to hang during startup when a "surprise member" was 
> added but then never timed out.  The system hung waiting for a response to a 
> startup message sent to the surprise member.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to