This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Count Bit Set | |
package com.algo.bits; | |
import java.io.*; | |
class countSetBits | |
{ | |
/* Function to get no of set | |
bits in binary representation | |
of positive integer n */ | |
static int countSetBits(int n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lock : This is the base interface for Lock API. It provides all the features of synchronized keyword with additional ways to create | |
different Conditions for locking, providing timeout for thread to wait for lock. methods are lock(),unlock(),tryLock(),newCondition() | |
Condition: Condition objects are similar to Object wait-notify model with additional feature to create different sets of wait. | |
A Condition object is always created by Lock object. Some of the important methods are await() that is similar to wait() and signal(), | |
signalAll() that is similar to notify() and notifyAll() methods. | |
Benefits : | |
synchronization blocks or methods can cover only one method whereas we can acquire the lock in one method and release it in another method | |
with Lock API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Control plane, Data Plane, Management Plane | |
FCAPS : | |
a). Fault (alarma), b). configure(Loopback,OSPF,RSVP,MPLS_TE) 3). Accounting(no of packets send recieve) 4). Performance (failed packets) | |
5). Security | |
SONET DWDM : | |
Dense wavelength division multiplexing (DWDM) is a fiber-optic transmission technique that employs light wavelengths to transmit data parallel | |
-by-bit or serial-by-character. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------- | |
In the java.util.concurrent package there are three interfaces: | |
Executor — Used to submit a new task. | |
ExecutorService — A subinterface of Executor that adds methods to manage lifecycle of threads used to run the submitted | |
tasks and methods to produce a Future to get a result from an asynchronous computation. | |
ScheduledExecutorService — A subinterface of ExecutorService, to execute commands periodically or after a given delay. | |
--------------------------------------------------------------- | |
*** How to Create an Executor *** | |
To create an Executor it is possible to use the factory Executors class. | |
Most common methods are used to create: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 -------------> 1 | |
Stock Stock_Daily_Record | |
@OneToOne(fetch = FetchType.LAZY, mappedBy = "stock", @OneToOne(fetch = FetchType.LAZY) | |
cascade = CascadeType.ALL) @PrimaryKeyJoinColumn | |
import javax.persistence.CascadeType; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.FetchType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 -------> many | |
Stock -------> Stock_Daily_Record | |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "stock") -------> @ManyToOne(fetch = FetchType.LAZY) | |
@JoinColumn(name = "STOCK_ID", nullable = false) | |
package com.mkyong.stock; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javax.persistence.Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Representational State Transfer uses HTTP protocol for data communication developed by Roy Fielding. | |
* Everything is Resource (REST uses various representations to represent a resource like Text, JSON and XML) | |
* RESTful web services are light weight, highly scalable and maintainable. | |
* Http methods : GET, PUT, POST, DELETE, OPTIONS | |
* PUT used to create a new resource and POST used to update the existing resource | |
* OPTIONS used to get the list of supported operations on a resource. | |
* A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks. | |
Ex:-------------- | |
we will create UserService.java, User.java,UserDao.java files under the com.tutorialspoint package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Inheritance 2. Polymorphism 3. Abstraction 4. Encaptulation | |
* Polymorphism --> Method OverLoading Method Overriding | |
* Method Overriding Rules: | |
a). public private protected modifier | |
class Parent | |
{ | |
protected Parent get() throws IOException | |
{ | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ForkJoinPool methods : | |
getActiveThreadCount(), getParallelism(), getPoolSize(), invoke(ForkJoinTask fjt), getRunningThreadCount() | |
RecursiveTask has method compute | |
Code: | |
*/ | |
package com.thread.fork; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
save Heap dump using jconsole : | |
Microsoft Windows [Version 6.1.7601] | |
Copyright (c) 2009 Microsoft Corporation. All rights reserved. | |
C:\Users\vikas.verma1>cd workspace\demo | |
C:\Users\vikas.verma1\workspace\demo> | |
C:\Users\vikas.verma1\workspace\demo>cd src |
NewerOlder