Monday, November 27, 2017

MongoDB nothing but JSON for NoSQL capability

MongoDB nothing but JSON for NoSQL capability

Does it clear for you.

Lets delve deeper for insight.

How does this NoSQL capability is built over,- it is by DescriminatorColumn, DescriminatorValue, InhertianceType

https://docs.oracle.com/javaee/5/api/javax/persistence/DiscriminatorValue.html

 Example:

    @Entity
    @Table(name="CUST")
    @Inheritance(strategy=SINGLE_TABLE)
    @DiscriminatorColumn(name="DISC", discriminatorType=STRING,length=20)
    @DiscriminatorValue("CUSTOMER")
    public class Customer { ... }

    @Entity
    @DiscriminatorValue("VCUSTOMER")
    public class ValuedCustomer extends Customer { ... }

Sunday, October 29, 2017

asnc..await in C#.net and javascript

[To be drafted]

async..await plays important role in C#.net and javascript (except for support to IE). This makes
program to get divided and executed in portion. Let me scribble more about in detail at earliest.

See you Soon!

Monday, October 2, 2017

YAML vs JSON

YAML is better than JSON its been said in a while over few interviews I had attended. When I'd referred internet, that's what I had I read as well. About YAML I had read in SpringBoot documentation under spring.io official site. As per them, YAML is better JSON. When I had look at YAML it was like more aggregated values for Java Property file, I mean more delved properties.

When it comes to JSON it is Javascript Object Notation, it is been passed as a string over net as part of transaction.

FOOBAR vs TFTP vs Gopher

FOOBAR - FTP Over Big Address Resolution, that's I think.
TFTP - Trivial FTP, Server Boot system,- BIOS is based on this protocol, allows resilient recovery on RAID  and other boot aspects.
Gopher - Menu based internet system protocol
FTP - File Transfer Protocol

Thursday, July 13, 2017

Setting Java Concurrent Package Non Blocking FutureTask Execution

Java has `Callable` interface, that belongs to `java.util.concurrent` package, which has a method `call()`.

In order to understand this context, its quite simple that concurrent package has `Callable` interface, this `call()` method could return object at run-time. `FutureTask` can take Callable Object through its constructor. For the `FutureTask` there is a `run()` method, served by Inheritance Hierarchy by `RunnableFuture`.

So when we extend `FutureTask` in order create Executor Framework task, its our responsibility to override `run()` method within the class which we create (extending `FutureTask`). Once we do that we get the body which act as execution block of Executor. Afterwards this `FurureTask` object can be passed to the framework based on the need by `V call()` method in run-time. This can be done by writing Governance classes which extends `Callable` Interface.

At run-time, `FutureTask run()` body is monitored & controlled by these methods

cancel(boolean);
isCancelled();
isDone();
V get() throws InterruptedException, ExecutionException;
V get(long, java.util.concurrent.TimeUnit) throws InterruptedException, ExecutionException, TimeoutException;

boolean isCancelled();
boolean isDone();
boolean cancel(boolean);
protected void done();
protected void set(V);
protected void setException(java.lang.Throwable);
protected boolean runAndReset();

`run()` method can be started by threading mechanism,- `thread_obj.start()`, rather we can go for `Executor` framework `execute()` which will take care of running FutureTask `run()` method. Over this we can have Fork, Enqueue, Dequeue, can do Atomic operations, Theadpool, Concurrency. And we could have `ReentrantLock`, `StampedLock`, `ReadWriteLock`, `ReentrantReadWriteLock`

`ExecutorService` class can make goverance to overall tasks, future tasks spawn. It serves method to shutdown the processes. We could judge the processes been shutdown or terminated. `shutdownNow()` shuts all the executor, future services and gives thead objects list. And we could presume by `invokeAll(? extends Callable)`, `invokeAny(? extends Callable)` also passing `java.util.concurrent.TimeUnit` is possible.

And by using `submit(Thread or Callable)`, we could instantiate Future object, it accepts either Thread or Callable.

For recursion, we can make use of these classes

`RecursiveAction`
`RecursiveTask`

We could delay the process by class by extending & overriding following interface

`Delayed.getDelay(java.util.concurrent.TimeUnit)`

In these classes delay of `java.util.concurrent.TimeUnit` is been taken care explicitly

`ScheduledExecutorService`
`ScheduledFuture`

`java.io.Closable` is abided within these FutureTask operations implicitly.


Following exception may arise while we work with `FutureTask`, `Executors`

`CompletionException`
`BrokenBarrierException`
`CancellationException`
`ExecutionException`
`RejectedExecutionException`
`TimeoutException`