Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # dev >> Reg:Sequence id generation


+
abhishek dodda 2012-06-07, 12:44
+
shashwat shriparv 2012-06-07, 13:22
Copy link to this message
-
Re: Reg:Sequence id generation
Actually trying to code this using map reduce program.

On Thu, Jun 7, 2012 at 6:22 AM, shashwat shriparv
<[EMAIL PROTECTED]> wrote:
> Try something like this :
>
>
> public class MyUniqueNumber
> {
>    private static MyUniqueNumber myUniqueNumber;
>    int number;
>    int seedValue=365432; //custom seed value to begin with
>
>    private MyUniqueNumber(){ //Singleton !!!
>        number=seedValue; //init to zero
>    }
>
>    public static MyUniqueNumber getInstance(){
>        if(myUniqueNumber==null){
>            myUniqueNumber=new MyUniqueNumber();
>        }
>        return myUniqueNumber;
>    }
>
>    public int getUniqueNumber(){
>        number+=1; //simple increment by 1 , you can modify this further
>        return number;
>    }
>    public static void main(String[] args)
>    {
>        MyUniqueNumber myUniqueNumber=MyUniqueNumber.getInstance();
>        for(int n=0;n<=5;n++){
>            System.out.println("read number:
> "+myUniqueNumber.getUniqueNumber());
>        }
>    }
> }
>
>
> On Thu, Jun 7, 2012 at 6:14 PM, abhishek dodda <[EMAIL PROTECTED]>wrote:
>
>> hi all,
>>
>>       I have a scenario where i should generate the sequence id . All
>> my tables are in DB2
>>
>
>
>
> --
>
>
> ∞
> Shashwat Shriparv
+
shashwat shriparv 2012-06-07, 13:22
+
abhishek dodda 2012-06-07, 12:50
+
Ashish 2012-06-07, 13:27
+
Harsh J 2012-06-07, 14:12
+
abhishek dodda 2012-06-07, 14:38