java.lang.NumberFormatException: multiple points已解决

问题:

多线程方法中使用了共享变量SimpleDateFormat,报如下错误:

 java.lang.NumberFormatException: multiple points
 at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1084

原因:

SimpleDateFormat是线程不安全的,切忌切忌!

 

解决:

在线程方法中,new SimpleDateFormat();

 

例:

       SimpleDateFormat sdf = new SimpleDateFormat();

      

class QueryUserByNoThread extends  Thread{
  LoginOpr loginOpr;
  CountDownLatch  countdown ;
  Map<String, Object> map;//构造返回信息
  Group group;
  String grpUId;
  SimpleDateFormat sdf;
  List<Cust> listCust;
  List<GroupMember> listMem;
  List<User> listUser;
  User user;
  Map<String, String> member = new HashMap<String, String>();
 
  
  /**
   * @param bo
   * @param loginOpr
   */
  public QueryUserByNoThread(LoginOpr loginOpr,CountDownLatch cdown,Map<String, String> member,Group group,String grpUId,List<Cust> listCust,List<GroupMember> listMem,List<User> listUser,User user,Map<String, Object> map) {
   super();
   this.member.putAll(member);
   this.countdown = cdown;
   this.map = map;
   this.group=group;
   this.grpUId = grpUId;
   this.sdf =  new SimpleDateFormat(Constants.DATE_MODEL_8);
   this.listMem = listMem;
   this.listUser = listUser;
   this.loginOpr = loginOpr;
   this.user=user;
   
   
  }

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值