Friday, April 13, 2018

Setting the limits in Linux permanently

https://singztechmusings.wordpress.com/2011/07/11/ulimit-how-to-permanently-set-kernel-limits-in-linux/


app soft nofile 16384
* hard memlock unlimited
elasticsearch hard memlock unlimited

root soft memlock unlimited
root hard memlock unlimited
#RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
elasticsearch soft RLIMIT_MEMLOCK 65536
elasticsearch hard RLIMIT_MEMLOCK 65536


 /etc/security/limits.conf I have set:
elasticsearch - nofile 65535
elasticsearch - memlock unlimited
root - memlock unlimited
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
docker - nofile 65535
docker - memlock unlimited
docker soft memlock unlimited
docker hard memlock unlimited
user hard memlock unlimited
user soft memlock unlimited
user - memlock unlimited

Monday, April 9, 2018

Difference between notify and notifyAll

package com.csco;


class ChildThread implements Runnable{
    private Object object;
    private String threadname;

    public ChildThread(Object object, String threadname) {
        this.object = object;
        this.threadname = threadname;
    }

    public void run(){
        synchronized (object){
            try {
                Thread.sleep(1000);
                System.out.println("This thread "+ threadname +" going to wait "+System.nanoTime());
                object.wait();
                System.out.println("This thread "+ threadname +" notified "+System.nanoTime());
              //  object.notifyAll();            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }
}


public class MainThread {
    public static void main(String[] args) {
        Object obj = new Object();
        ChildThread th1 = new ChildThread(obj,"thread1");
        ChildThread th2 = new ChildThread(obj,"thread2");
        ChildThread th3 = new ChildThread(obj,"thread3");
        ChildThread th4 = new ChildThread(obj,"thread4");
        ChildThread th5 = new ChildThread(obj,"thread5");

        new Thread(th1).start();
        new Thread(th2).start();
        new Thread(th3).start();
        new Thread(th4).start();
        new Thread(th5).start();

        try {
            Thread.sleep(6000);
            synchronized (obj) {
                obj.notify(); // Change this to notifyAll to see the difference                
                System.out.println("Done");
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

Friday, March 23, 2018

Really Advance Java



      https://stackoverflow.com/questions/37572095/self-referencing-generics-in-java
      http://freddy33.blogspot.com/2007/05/why-java-enum-cannot-extends.html
     

Monday, March 12, 2018

Thursday, March 8, 2018

TransportSerializationException[Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.state.ClusterStateResponse]]; nested: IndexOutOfBoundsException[Readable byte limit exceeded: 1031];

TransportSerializationException[Failed to deserialize response of type [org.elasticsearch.action.admin.cluster.state.ClusterStateResponse]]; nested: IndexOutOfBoundsException[Readable byte limit exceeded: 1031];


Solution : Make sure Transportclient and Elasticsearch versions are compatible.

Sunday, January 14, 2018

App Idea




All the shopkeepers install the app and build a small web-page or something to tell what they sell. This is on shopkeepers's or shop's mobile . When consumers install app they can see categories wise what people around them are selling. You can turn app off at night or turn it on at night etc.

Setting the limits in Linux permanently

https://singztechmusings.wordpress.com/2011/07/11/ulimit-how-to-permanently-set-kernel-limits-in-linux/ app soft nofile   16384 * hard...