weixin_39603217
weixin_39603217
2020-12-09 14:37

thread-unsafe race condition in

The method is not synchronized; more than one thread could create and insert a CommandMapper:

public static CommandMapper getInstance(String instanceName) { CommandMapper cm = (CommandMapper)instanceMap.get(instanceName); if (cm == null)

{ cm = new CommandMapper(); cm.instanceName = instanceName; instanceMap.put(instanceName, cm); }

return cm; }

Environment

Operating System: All Platform: All

Affected Versions

[9.1pe]

该提问来源于开源项目:eclipse-ee4j/glassfish

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

12条回答

  • weixin_39603217 weixin_39603217 5月前
    • Issue Imported From: https://github.com/javaee/glassfish/issues/2131
    • Original Issue Raised By:
    • Original Issue Assigned To:
    • Original Issue Closed By:
    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented llc said: Also, 'instanceMap' is a HashMap, which is not synchronized internally. Sporadic ConcurrentModificationExceptions could occur.

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented gfbugbridge said:

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented gfbugbridge said: Reassign to Siraj

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented gfbugbridge said: Reassign to Siraj

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented sridatta said: will be fixed for FCS.Downgrading to a P3.

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented sirajg said: Fix the issue by synchronizing method

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented sirajg said: fixed by making method synchronized

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented Was assigned to sirajg

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented This issue was imported from java.net JIRA GLASSFISH-2131

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented Reported by llc

    点赞 评论 复制链接分享
  • weixin_39603217 weixin_39603217 5月前

    Commented Marked as fixed on Tuesday, February 20th 2007, 3:55:37 am

    点赞 评论 复制链接分享

相关推荐