English 中文(简体)
是否有一座 Java藏处理图书馆?
原标题:Is there a Java Library for Collection Processing?

我不得不通过每月150 000多件藏书,每次收件大约需要3至4小时的罚款。 问题是,有些数据有时扔下了,但除外。 (这当然是在我第一次测试时发生的,直到项目148 000。) 我简单地把它定在逻辑上无视例外(当然是这样说),但我认识到,我并不总是想简单地无视例外。

我写了一幅简单例外的手稿,其中涉及不同类型的例外情况,如果出现某种例外情况,则需要做些什么;例如,如果我收到一个<条码>SQLException。 I abort the process, but on an NullPointerException 我继续这样做,因为数据通常是一个问题。 我也跟踪了例外情况的总数,如果我打上了预设限,我也就杀了这一进程。

因此,我的问题是:我将为处理<代码>Collections中不同类型的数据而建设更多的这些方案。 是否设有一个图书馆,负责收集和处理不同类型的例外情况?

下面是我根据评论要求加入的一些法典。 如果你想放弃,“你想要做什么,问题是什么?” 但是,我很想知道,是否有一个图书馆,让我登记例外情况,以及遇到什么事情。 例如,在A类或D类例外情况出现时,如果B类的例外情况继续存在,除非发生X次,否则C类的继续发生,而完全无视E。 我和其他人今后将同心协力,希望能够使用一些一致的东西。

《基本法》:

exeptionLimit = 50;
exceptionCount = 0;
for (long id : MyCollection)
{
     try
     {
         //All these methods throw the exceptions 
         Item item = getItemById(id);
         NewData data = ProcessItem(item);
         SaveNewData(data);
     }
     catch (SQLException e)
     {
         //log

         throw e; //I want this to cause the process to fail
     }
     catch (NullPointerException e)
     {
          //log
          exceptionCount++;
          if (exceptionCount >= exceptionLimit) throw new Exception("Limit hit!");
     }
}
问题回答

A Collection represent a logical grouping of data and a set of functions to operate on the data.
You can find libraries that offer advanced data-structures and better performance than what is offered in the JDK but if I understand your question correctly, what you need is something to understand the logic you want to build on top of the collection.
I mean, the separation between different types of exceptions and if they are logged or not etc. are part of your application logic.
It is not something related to a collections framework which offers exactly that. Collections and helper methods on data

我最后把我自己的解决办法放在一起,但最近却 st卑地对待阿斯同步的再工业模式:

https://github.com/nurkiewicz/async-retry”rel=“nofollow”>https://github.com/nurkiewicz/async-retry

该条内容良好:

http://nurkiewicz.blogspot.com/07/asynchronous-retry-pattern.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签